bash: nodemon command not found windows 10

3
我花了很多时间寻找解决方案,但没有找到(适用于我的情况)。因此... 我检查了全局包npm list -g --depth=0并得到了以下结果:
enter image description here

但是当我进入文件夹C:\Users\Sergey\AppData\Roaming\npm\node_modules时,没有nodemon。 enter image description here

我知道这个问题已经存在。请有人帮帮我...


随着 npx 命令的添加,现在没有必要再全局安装这些东西了。将 nodemon 作为 devDependency 安装到您的项目中,然后键入 npx nodemon。当使用 npm run scriptname 运行时,npx 命令将执行与 package.json 中的 script 相同的本地优先搜索二进制文件。当您有时间时,仍应在 package.json 中添加一个脚本,因为它记录了 nodemon 在您的项目中的使用方式。 - skylize
3个回答

7
我发现了一个解决方案(在我这里有效)。
你只需要将C:\Users\Sergey\AppData\Roaming\npmC:\usr\local(当然是你的npm和local文件路径)添加到系统变量中(控制面板\系统和安全\系统\高级系统设置)
之后重新启动电脑即可。 enter image description here

你是指第四步吗?这里有两行分开的。 - Sergey Andreev
是的,第四步,当我编辑路径时,我只得到了一行,所有条目都以分号分隔在其中。 - Gabriel Bleu
1
在第三个路径中,您需要点击“路径”,然后(在第四个路径中)单击第一个按钮“创建”,并添加完整的路径。 - Sergey Andreev
1
同时重新启动电脑。 - Sergey Andreev

5

您尝试过重新安装nodemon吗?

npm i -g nodemon@latest

如果这也不起作用,请在您的项目中安装nodemon,但不要将其保存为依赖项。


-3

此外,您可以删除 node 文件夹并重新安装 nodeJS


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接