简体   繁体   English

(Windows) 如何修复 nodemon | Node.js

[英](Windows) How to fix nodemon | Node.js

So I started using nodemon a while ago and started to use it again recently.所以我前一阵子开始使用nodemon ,最近又开始使用它。 But I got an error from the VS-Code command line:但是我从 VS-Code 命令行得到一个错误:

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.
At line:1 char:1
+ nodemon
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (nodemon:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

This basically means it isn't a command, similar thing would happen in an actual cmd.这基本上意味着它不是命令,类似的事情会发生在实际的 cmd 中。

Edit: I made this Q&A just for some people who have this same problem.编辑:我为一些有同样问题的人做了这个问答。

So I started using nodemon a while ago and started to use it again recently.所以nodemon开始用nodemon ,最近又开始用了。 But I got an error from the VS-Code command line:但是我从 VS-Code 命令行收到错误消息:

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.
At line:1 char:1
+ nodemon
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (nodemon:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

This basically means it isn't a command, similar thing would happen in an actual cmd.这基本上意味着它不是命令,类似的事情会发生在实际的 cmd 中。

Edit: I made this Q&A just for some people who have this same problem.编辑:我为一些有同样问题的人做了这个问答。

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 like之后你必须运行这个命令: npm run dev here dev is (script) server name like

{  
"main": "app.js",
"scripts": {
    "dev": "nodemon app.js"
  },
} 
  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.

相关问题 无法在Windows上为node.js安装nodemon - Unable to install nodemon on Windows for node.js Windows 上 node.js 的 IISNode 和/或 nodemon - IISNode and/or nodemon for node.js on Windows Windows上的Node.js nodemon不能观看嵌套的目录吗? - Node.js nodemon on windows doesn't watch nested dirs? Node.js DEBUG =应用程序名称nodemon在Windows上不起作用 - Node.js DEBUG=appname nodemon not working on windows 如何使用Forever和Nodemon(Windows)自动重启Node.js应用程序 - How can I automatically restart a Node.js application using Forever and Nodemon (Windows) 如何使用 nodemon 在 Node.js 上自动创建 mysql 数据库? - How to automate mysql database creation on Node.js with nodemon? 如何使用 nodemon 每天自动重启 node.js 脚本? - How to automatically restart a node.js script daily using nodemon? Node.js v18.13.0 [nodemon] 应用程序崩溃 - 在启动之前等待文件更改... - 我该如何解决? - Node.js v18.13.0 [nodemon] app crashed - waiting for file changes before starting... - How can I fix it? 什么是“节点”工作的问题,但“nodemon”不是在node.js中的64位Windows 7上工作? - What is the issue “node” is working but “nodemon” is not woking on windows 7 64-bit in node.js? Nodemon 已安装但在 Node.js 中不起作用 - Nodemon installed but not working in Node.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM