How to fix global nodemon node package install error on Linux

To install nodemon globally on Linux, below command:
$ npm install -g nodemon <enter>

will not work as it requires root privileges.

If it is installed with :
$ sudo npm install -g nodemon <enter>

it will install on the local machine in the root folders.

If we do not want to install it globally on our Linux computer, we need to install it locally in our node_modules folder only. To install nodemon on Linux locally without root privileges, open the terminal window and enter the command below:
$ npm i nodemon <enter>

It cannot be be run using node nodemon server.js, since it is installed locally. To run nodemon as a local service in Linux, open a terminal window and run the javascript as below:
$ npx nodemon server.js <enter>

Now it will work. If code changes in server.js, nodemon will detect the changes and when the route is referenced from a browser, it will show the updated content.