Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Node.js installation with nvm on Raspberry pi
- A Raspberry pi with Raspbian installed.
- An internet access.
$ sudo apt update -y && sudo apt upgrade -y
Wait a very long time...
(Node Version Manager, https://github.com/creationix/nvm)
Execute following commands:
$ git clone https://github.com/creationix/nvm.git ~/.nvm $ sudo echo "source ~/.nvm/nvm.sh" >> ~/.bashrc && sudo echo "source ~/.nvm/nvm.sh" >> ~/.profile
Exit all terminals and/or ssh sessions and open a new one.
Check if installation work
$ nvm --version
Should return the version of nvm installed. (for me 0.25.4)
You can see all available version of node js at this url http://nodejs.org/dist/. When you click on http://nodejs.org/dist/v0.10.26/, you can see that it was compiled for the raspberry pi (you can see the file:
Install node.js and upgrade npm by running these commands:
$ nvm install 8.11.4 # Or this (for latest LTS version) $ nvm install --lts # Switch to installed node version $ nvm use 8.11.4 # Or switch to LTS $ nvm use --lts # then update npm $ npm -g install npm@latest --allow-root --unsafe-perm