简体   繁体   English

由于 index.js 移动,Nodemon 命令无法识别

[英]Nodemon command is not recognized since index.js moved

I have an issue since I moved my "index.js" file out of the same location I have my 'package.json' for my server.我有一个问题,因为我将我的“index.js”文件移出了我的服务器的“package.json”的同一位置。 Now, every time I want to run my server with the 'npm run dev' command, the following error appears on the console:现在,每次我想使用“npm run dev”命令运行我的服务器时,控制台上都会出现以下错误:

nodemon is not recognized as internal or external command, operable program or batch file

My code on my server's package.json looks like this:我的服务器 package.json 上的代码如下所示:

"scripts": {
  "start": "nodemon index.js",
  "dev": "set NODE_ENV=development && nodemon server.js",
  "prod": "set NODE_ENV=production && nodemon server.js"
}

My index.js file is on server/index/index.js , while my package.json is on my server's home directory.我的index.js文件在server/index/index.js上,而我的package.json在我服务器的主目录上。 I tried to change my start command like this:我试图像这样更改我的start命令:

"start": "nodemon../index/index.js"

but that doesn't seem to work.但这似乎不起作用。 Any suggestions?有什么建议么?

Try to install nodemon globally:尝试全局安装 nodemon:

npm install -g nodemon 

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM