DEV Community

Cover image for Nodemon running error fixed!
Stephen O.
Stephen O.

Posted on

Nodemon running error fixed!

About a few days ago, I was working on my backend skills learning Nodejs and installed the common nodemon package that helps us automatically save our updated work in code and re-runs to log the new result in the terminal, only to experience a striking fault that shouldn’t have been.

According to sources of tutorials and documentations, including nodemon documentation, states that the nodemon package is run as thus: nodemon [your node app] in most cases the node app is usually the app.js or whatever file you declared your node code. But in this case "app.js" so,

nodemon app
Enter fullscreen mode Exit fullscreen mode


Unfortunately, this command line doesn’t work as it should. Instead, this is the response error I get on the VSCode terminal.

Image description

If you’ve been in this situation like me, It can be mind-wretching. You can try checking if the package is installed properly by typing npm nodemon --version or npm nodemon -v to check the version.
StackOverflow and various YouTube tutorials may offer you solutions and ways to get this fixed. If you have tried all but to no avail, here is a help I can offer.

Try typing npx nodemon app into the command line and press “Enter”;

npx nodemon app
Enter fullscreen mode Exit fullscreen mode

It should work;

Image description

The Node Package eXecute once again proves to be useful in cases like this.

NPX is simply an NPM package runner, a command line tool primarily used for executing Nodejs packages without installing them; comes automatically with NPM version 5.2. It simplifies the development process by allowing developers to test new packages and experiment with different package versions without cluttering their systems with too many installations.

Lots of us are already familiar with this. A re-touch just for new developers encountering this command for the first time. NPM is used to download Javascript packages from Node Package Manager, and npx is used to execute JavaScript packages downloaded this way.

Guys, the npx command did the magic for me.

If you are using the gitbash terminal, the normal nodemon app command should run efficiently in your system. But if you are experiencing a similar error, you can go ahead and try the npx nodemon app command line.

If this doesn’t solve your problem, I still suggest you revisit stackoverflow or ask a community of developers or a senior developer.
I hope your nodemon running error problem get fixed!

Top comments (0)