Node installation best practices
Installing node.js can be terrible.
- if you’re going to install it on your development machine, don’t use the setup from nodejs.org
- don’t install it using your system package manager. Those repo are usually outdated and you may broke your node installation.
- installing on a development machine using one of the methods above, will lead to crazy permissions that will eventually make you crazy, too. See this and this.
Then, what to do?
On a development machine
- Install node with NVM (Node Version Manager).
- Check the nvm repo on github and run the install command
- Install Node.js using
nvm install stable
- Activate it and set it as default with
nvm alias default stable
nvm use <version> is a handy way to set a different node version, but it won’t be persistent. To make it so, use
nvm alias default <version> instead.
On a production machine
- You can install node directly using the website installer, with appropriate permissions.
If you stumble upon
unknown option '-q'
error, please check this article to fix it.
Thanks for reading.
This blog post takes a lot from this great reply on stackoverflow. Thanks to the author.
Got some words you want to share? Tell me!