'Nodemon npm will not run, error gets thrown everytime
I had nodemon working the first day I installed it, when I came back the next day it threw this error:
PS C:\Users\markc\Desktop\Udemy Nodejs\code> nodemon -v
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 -v
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (nodemon:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Now some things I have tried to fix:
uninstalling and reinstalling uninstalling and reinstalling globally uninstalling and installing a similar package like forever. Forever threw the same errors.
I think there is a problem with my path, however, I saw other issues on this forum from other users and added the correct path to my system variables... error still gets thrown.
I am at a complete loss here and could really use some troubleshooting help.
Solution 1:[1]
If you are installing Nodemon globally via npm install --global nodemon restart your console after doing so.
If using VSCode, make sure to close/kill all terminal panels before restarting VSCode. VSCode tries to restore your previous session and won't recognize updated environment variables if the terminal is still open before restarting the app.
If you are installing locally via nmp install nodemon --save-dev for instance, you can't run nodemon -v from the command line but can run it if you setup scripts in your package.json.
"scripts": {
"test": "nodemon index.js",
"start": "node index.js"
},
This would then allow you to run npm test.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ahren Bader-Jarvis |
