Electron-vue: Cannot find module 'vue'

Created on 23 Jan 2017  路  15Comments  路  Source: SimulatedGREG/electron-vue

Describe the issue / bug.

previous version (webpack 1) its works fine, but in current version (webpack2) i got this error " Cannot find module 'vue' "

How can I reproduce this problem?

install new version from vue-cli on window10 , npm i and finally run with "npm run dev" command.

If visual, provide a screenshot.

2017-01-23_212202

Tell me about your development environment.
  • Node version: 6.9.1
  • NPM version: 3.10.10
  • vue-cli version: 2.10
  • Operating System: windows10
bug windows-specfic

Most helpful comment

@charlesdelorme You must have coppied it just before my edit.
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.appModules.replace(/\\/g,'\\\\') %>')

All 15 comments

From #102

Node version: 7.4
NPM version: 4.1.2
vue-cli version: (if necessary) 2.8
Operating System: Windows 10 x64

Update: Seems like this could be a Windows issue

@RezaHaidari

Can you confirm node_modules were installed inside the app directory?

Yes, they installed under /app/node_modules/

-vue
-vue-electron
-vue-router
-vuex

@MatthewOverall

Are you also on Windows?

Yes

What can I do to help? I just pulled this down for the first time and can't see immediately where the issue is coming from. If you can't replicate the issue in your environment I would be glad to set up a remote session.

@MatthewOverall

Currently trying to investigate within a virtual box. But I think it might be an issue trying to add app/node_modules to globalPaths in app/index.ejs.

Could you run npm run dev and check the source code within the dev tools to see if the path being pushed to globalPaths is the correct path to the app/node_modules directory.

Yes, you are correct, the path seperator is acting as an escape char.
require('module').globalPaths.push('D:\Source\cube-utils-ui\app\node_modules')
vs
require('module').globalPaths.push('D:\\Source\\cube-utils-ui\\app\\node_modules')

Just caught that myself, lol. This is pretty unfortunate, going to apply a fix shortly.

image

In the meantime @RezaHaidari, until @SimulatedGREG releases the fix.

replace
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.appModules %>')
with
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.appModules.replace(/\\/g,'\\\\') %>')

inside the index.ejs file.

Your fix dosen't work for me @MatthewOverall.
The new fixed path is incorrect, my path doesn't have any "/" by default.
(With htmlWebpackPlugin.options.appModules)

Path with the new fix:
path

@charlesdelorme

copy new update, that works for me.

thanks @MatthewOverall

@charlesdelorme You must have coppied it just before my edit.
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.appModules.replace(/\\/g,'\\\\') %>')

Thanks for the help @MatthewOverall ! My virtual box is very sluggish to get things done quickly.

@SimulatedGREG

Glad to help. Thanks for creating this boiler plate project. Really well done.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pansila picture pansila  路  3Comments

Oriol-GG picture Oriol-GG  路  3Comments

blackw212 picture blackw212  路  3Comments

rodrigomata picture rodrigomata  路  3Comments

webrtcn picture webrtcn  路  3Comments