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.
At line:1 char:1
+ nodemon Server1.js
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (nodemon:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我尝试在直接 JS 文件中再次运行它,但没有成功。 我也尝试在删除整个文件夹后再次尝试,但它不起作用。
nodemon
是否作为 devDependency
安装在您的项目中或全局中?如果它只是一个 devDependency
,那么它会安装到您的 node_modules
,并且 nodemon
应该是 node_modules/.bin/nodemon
下的可执行文件。但它不会在你外壳的PATH
中。
如果您运行
npx nodemon
,它会自动将 node_modules/.bin
添加到您的路径,或者如果您在 nodemon
脚本内运行 package.json
,则会自动添加到您的路径。但是如果没有这两种方法,您不能直接从 shell 调用 nodemon
。