简体   繁体   English

终端无法识别 nodemon 命令

[英]nodemon command not recognized by terminal

I am trying to automate the server reload using the nodemon.我正在尝试使用 nodemon 自动重新加载服务器。 I have it installed locally and have the start set to我已在本地安装它并将开始设置为

nodemon app.js using the code: nodemon app.js使用代码:

"scripts": { "start": "nodemon app.js" }

It ran fine for the first time, but after shutting down the system once and reopening my project, it does not seem to run properly anymore.第一次运行良好,但关闭系统一次并重新打开我的项目后,它似乎不再正常运行。 Now it throws an error every time I use the command nodemon app.js .现在每次我使用命令nodemon app.js都会引发错误。

The error line is:错误行是:

nodemon: The term 'nodemon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

VS Code 终端中显示的错误行

The best solution I could go about this is:我可以解决的最佳解决方案是:

 npm install -D nodemon // install as a dev dependency

 npm start // run script start

Below are some solutions下面是一些解决方案

  1. This is how you can install nodemon这是安装nodemon的方法
npm install -g nodemon

after that you have to run this command: npm run dev here dev is (script) server name之后你必须运行这个命令: npm run dev here dev is (script) server name

  1. after that if you are facing error like " 'nodemon' is not recognized as an internal or external command, operable program or batch file. " Then after install nodemon globally write below command:之后,如果您遇到诸如“'nodemon' 未被识别为内部或外部命令、可运行程序或批处理文件之类的错误。”然后在全局安装 nodemon 后写入以下命令:
npm config get prefix

in output you will get PATH and then past this path in to the Environment Variables and it solved在 output 中,您将获得 PATH ,然后通过此路径进入环境变量并解决

Restart the terminal and run this command重新启动终端并运行此命令

nodemon run dev

I hope after that it will work properly:)我希望之后它会正常工作:)

暂无
暂无

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

相关问题 在 node js 服务器的终端中无法识别 nodemon 命令 - nodemon command is not recognized in terminal for node js server 无法将“ nodemon”识别为内部或外部命令,可操作程序或批处理文件 - 'nodemon' is not recognized as an internal or external command, operable program or batch file 由于 index.js 移动,Nodemon 命令无法识别 - Nodemon command is not recognized since index.js moved [NODEMON]- babel-node 未被识别为内部或外部命令 - [NODEMON]- babel-node not recognized as internal or external command 在 nodejs 中使用 npm 开始的问题。 'nodemon' 不是内部或外部命令、可运行程序或批处理文件 - poblem with use the npm start in nodejs . 'nodemon' is not recognized as an internal or external command, operable program or batch file NPM nodemon并在终端中调试无输出 - NPM nodemon and debug no output in terminal bash:nodemon:找不到命令 - bash: nodemon: command not found Nodemon 命令不起作用 未经授权的访问 - Nodemon Command Not Working Unauthorized Access React-native:[NODEMON] 启动 `babel-node src`,“babel-node”未被识别为内部或外部命令,而我运行“npm run dev” - React-native: [NODEMON] starting `babel-node src`, "babel-node" is not recognized as an internal or external command, while I run 'npm run dev' 如何在 macOS 上安装 nodemon Nodejs? nodemon 保持显示:找不到命令 - How to install nodemon Nodejs on macOS? nodemon keeping show : command not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM