I encountered some problems while trying to install nodemon with the command line of 'npm install -g nodemon'
as shown in the image below.
You should never need to run npm install -g
with root privileges - if you are getting permission errors then this means that npm has been installed incorrectly. The npm website provides fairly comprehensive documentation on how to fix this - https://docs.npmjs.com/getting-started/fixing-npm-permissions
The best options are to either use a package manager to install npm, such as Homebrew on MacOS. Node Version Manager (NVM) can also ease the process, as well as providing support for using different node versions. Alternatively you can either change the ownership of /usr/local
so that your current user has permissions there, or change the folder used by npm to one owner by the current user.