0

在为 Vue.js 应用程序设置环境时,我遇到了与 node_modules 和 nodemon 相关的 npm start 问题。运行 $npm start 命令时,我在控制台中收到此错误:

$ npm start

> server@1.0.0 start C:\Users\Michał\desktop\it\vueapptrain\server
> node .node_modules/nodemon/.bin/nodemon.js src/app.js --exec 'npm run lint && node'

module.js:515
    throw err;
    ^

Error: Cannot find module 'C:\Users\Michał\desktop\it\vueapptrain\server\.node_modules\nodemon\.bin\nodemon.js'
    at Function.Module._resolveFilename (module.js:513:15)
    at Function.Module._load (module.js:463:25)
    at Function.Module.runMain (module.js:653:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server@1.0.0 start: `node .node_modules/nodemon/.bin/nodemon.js src/app.js --exec 'npm run lint && node'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

有什么想法可以解决这个问题吗?

4

1 回答 1

1

首先,确保您已nodemon安装;npm i nodemon -S.


然后,编辑你的启动脚本package.json到这个,

node ./node_modules/.bin/nodemon src/app.js --exec 'npm run lint && node'

于 2017-10-30T22:03:30.233 回答