简体   繁体   English

npm start命令出现问题

[英]Issue with npm start command

While setting the environment for the Vue.js app I have encountered the issue with npm start related to node_modules and nodemon. 在设置Vue.js应用程序的环境时,我遇到了与node_modules和nodemon相关的npm start问题。 I am getting this error in the console when running the $npm start command: 运行$ 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.

Any ideas how this can be solved? 有什么想法可以解决吗?

Firstly, ensure you have nodemon installed; 首先,确保已安装nodemon npm i nodemon -S . npm i nodemon -S


Then, edit the start script in your package.json to this, 然后,将package.json的启动脚本编辑为此,

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM