Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Cannot find module 'vue' #101

Closed
RezaHaidari opened this issue Jan 23, 2017 · 15 comments
Closed

Cannot find module 'vue' #101

RezaHaidari opened this issue Jan 23, 2017 · 15 comments

Comments

@RezaHaidari
Copy link

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
@SimulatedGREG
Copy link
Owner

SimulatedGREG commented Jan 23, 2017

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

@SimulatedGREG
Copy link
Owner

@RezaHaidari

Can you confirm node_modules were installed inside the app directory?

@MatthewOverall
Copy link

Yes, they installed under /app/node_modules/

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

@SimulatedGREG
Copy link
Owner

@MatthewOverall

Are you also on Windows?

@MatthewOverall
Copy link

Yes

@MatthewOverall
Copy link

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.

@SimulatedGREG
Copy link
Owner

SimulatedGREG commented Jan 23, 2017

@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.

@MatthewOverall
Copy link

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')

@SimulatedGREG
Copy link
Owner

SimulatedGREG commented Jan 23, 2017

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

image

@MatthewOverall
Copy link

MatthewOverall commented Jan 23, 2017

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.

@emilydelorme
Copy link

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

@RezaHaidari
Copy link
Author

RezaHaidari commented Jan 23, 2017

@CharlesDelorme

copy new update, that works for me.

thanks @MatthewOverall

@MatthewOverall
Copy link

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

@SimulatedGREG
Copy link
Owner

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

@MatthewOverall
Copy link

@SimulatedGREG

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants