npm start命令问题

时间:2017-10-30 21:39:48

标签: node.js vue.js node-modules nodemon npm-start

在为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.

任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

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


然后,将package.json中的开始脚本编辑为

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