Skip to content

Instantly share code, notes, and snippets.

@heartbeast42
Last active June 18, 2019 03:26
Show Gist options
  • Save heartbeast42/c7e1739f1a08791d9cca32ab1880f199 to your computer and use it in GitHub Desktop.
Save heartbeast42/c7e1739f1a08791d9cca32ab1880f199 to your computer and use it in GitHub Desktop.
Robust proper Instalation of nvm, npm, node and nodemon in debian/ubuntu based linux distributions

If you're having trouble installing nodemon globally like I was these steps solved it for me.

install npm with the following commands

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y nodejs

test your install with npm -v install node from NVM and install NVM from here https://github.com/nvm-sh/nvm To install the latest lts version of node run, other versions are available but for most of us the lts is preferable

nvm install --lts

Finally install nodemon like so

npm install -g nodemon

now test nodemon out on something to make sure it's working


if you get an error like

[nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached . . .

the problem is that the "max_user_watches" allowed for the user is too low to see your current max_user_watches run the following command

sysctl -a | grep fs.inotify.max_user_watches

in my case the max_user_watches was at fs.inotify.max_user_watches = 8192, which was too low you can increase max_user_watches by running the following command

echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

this increase max_user_watches to 582222, which in my case is enough

If you have any questions or you find any errors in this document pleas feel free to reach out, I won't bite :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment