How to Solve Nodemon Command Not Found Error in Linux Bash

Yahya Irmak Feb 02, 2024
How to Solve Nodemon Command Not Found Error in Linux Bash

The nodemon is a Node.js tool that helps develop applications by restarting the node application automatically when file changes in the directory are detected. This article will explain how to install nodemon and solve this error in Linux Bash.

Solve the bash: nodemon: command not found Error in Linux Bash

You get the bash: nodemon: command not found error because the nodemon tool is not correctly installed on your system. The rest of the article explains different ways to download this tool.

The nodemon tool can be installed with the following command.

sudo npm install -g nodemon

If you are getting the bash: nodemon: command not found error even though nodemon is installed on your system, try uninstalling and installing it again.

npm uninstall nodemon
sudo npm uninstall -g nodemon

The --force argument will force npm to install remote resources even if a local copy exists on disk. You can also use this option to reinstall.

sudo npm install -g --force nodemon

The --save-dev argument is used to save the package for development purposes. Try to install nodemon with this option.

sudo npm install nodemon --save-dev

If you did a local install, nodemon would not be available in your system path. You can run it locally instead of globally with the npx command.

npx nodemon app.js

You may get this error because the npm is not added to the system path. Add the following command into the .bashrc file.

export PATH=$PATH:~/npm

You can successfully install the nodemon tool by choosing the one that suits you best from these options. To check the installation, check the version of the tools.

nodemon --version

Now you can use the nodemon tool with your applications. After doing these, if you still get the error in your development environment, close the application and open it again.

Author: Yahya Irmak
Yahya Irmak avatar Yahya Irmak avatar

Yahya Irmak has experience in full stack technologies such as Java, Spring Boot, JavaScript, CSS, HTML.

LinkedIn

Related Article - Bash Error