我正在建立一个新的Vue项目,并在CMD中运行npm run serve命令时,出现以下错误:

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! real-world-vue@0.1.0 serve: 'vue-cli-service serve'
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the real-world-vue@0.1.0 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

我需要做什么?

我已阅读日志,卸载并重新安装了NPM,Vue,Node.js,并在Google上阅读了一些背景信息,但没有任何效果。

最佳答案

在我的情况下(Windows),node_modules\.bin\vue-cli-service.cmd失败了,因为我的一个父文件夹中有一个&符,导致%~dp0中断

关于vue.js - 如何修复 'Cannot find module vue-cli-service.js'?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57925293/

10-12 12:33
查看更多