Nodemon command is not recognized since index.js moved

Viewed 32

I have an issue since I moved my "index.js" file out of the same location I have my 'package.json' for my server. Now, every time I want to run my server with the 'npm run dev' command, the following error appears on the console:

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:

"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. I tried to change my start command like this:

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

but that doesn't seem to work. Any suggestions?

1 Answers

Try to install nodemon globally:

npm install -g nodemon 
Related