Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'Cannot find module vue-cli-service.js'?

I'm setting up a new Vue project and when I'm running the command npm run serve into CMD, the following error appears:

Error: Cannot find module 'C:\Users\Bram Wicherink\@vue\cli-service\bin\vue-cli-service.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] serve: 'vue-cli-service serve'
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Bram Wicherink\AppData\Roaming\npm-cache\_logs\2019-09-13T14_03_01_676Z-debug.log

What do I have to do?

I have read the logs, I uninstalled and reinstalled NPM, Vue, Node.js and read some background information on Google, but nothing worked.

like image 561
Bram Avatar asked Sep 13 '19 14:09

Bram


1 Answers

In my case (Windows), the node_modules\.bin\vue-cli-service.cmd was failing because one of my parent folders had an ampersand character which breaks %~dp0

like image 63
6footunder Avatar answered Sep 20 '22 11:09

6footunder