PS D:\VSCODE\express-demo> npm run dev//跟着视频的步骤报错
npm ERR! missing script: dev
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache\_logs\2021-04-13T06_09_30_179Z-debug.log
PS D:\VSCODE\express-demo> npm start//使用之前的启动方法报错
> express-demo@1.0.0 start D:\VSCODE\express-demo
> nodemon ./src/app.js
'nodemon' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-demo@1.0.0 start: `nodemon ./src/app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the express-demo@1.0.0 start 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! D:\nodejs\node_cache\_logs\2021-04-13T06_09_39_374Z-debug.log
看package.json的依赖中有没有引进nodemon 如果没有可以使用命令 npm install --save-dev nodemon
得到解决了
在VScode的终端中输入命令是报错的,但是在cmd中运行npm start服务又能正常启动了