Created
June 21, 2018 06:48
-
-
Save thaliaarchi/ee20738b13e77606cc21cf9e042b27b0 to your computer and use it in GitHub Desktop.
Install node and npm on a Raspberry Pi or other ARM-based systems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://raspberrypi.stackexchange.com/questions/4194/getting-npm-installed-on-raspberry-pi-wheezy-image | |
# Deletes previous installation of node | |
# Architecture can be found with `uname -m` | |
version=$1 | |
if [ $# -eq 0 ]; then | |
read -p "Node version to install (e.g. v8.11.3): " version | |
fi | |
arch=linux-armv7l | |
node=node-$version-$arch | |
wget https://nodejs.org/dist/$version/$node.tar.gz | |
tar -xzf $node.tar.gz && rm $node.tar.gz | |
sudo rm -rf /opt/nodejs | |
sudo mv $node /opt/nodejs | |
sudo rm /usr/bin/node /usr/bin/npm | |
sudo ln -s /opt/nodejs/bin/node /usr/bin/node | |
sudo ln -s /opt/nodejs/bin/npm /usr/bin/npm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment