Last active
March 8, 2024 22:37
-
-
Save myrtleTree33/8080843 to your computer and use it in GitHub Desktop.
Install Node JS in 30 seconds for Raspberry Pi / ARM
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
#!/bin/bash | |
## Check for versions compiled with ARM at http://nodejs.org/dist/ | |
## Inspired by http://oskarhane.com/raspberry-pi-install-node-js-and-npm/ | |
## Fill in the Node Version here: | |
########################################################################## | |
NODE_VERSION="v0.10.21" | |
########################################################################## | |
#Make a new dir where you'll put the binary | |
sudo mkdir /opt/node | |
#Get it | |
wget http://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERRSION}-linux-arm-pi.tar.gz | |
#unpack | |
tar xvzf node-${NODE_VERSION}-linux-arm-pi.tar.gz | |
#Copy to the dir you made as the first step | |
sudo cp -r node-${NODE_VERSION}-linux-arm-pi/* /opt/node | |
#Add node to your path so you can call it with just "node" | |
#Add these lines to the file you opened | |
PROFILE_TEXT=" | |
PATH=\$PATH:/opt/node/bin | |
export PATH | |
" | |
echo "$PROFILE_TEXT" >> ~/.bash_profile | |
source ~/.bash_profile | |
# linking for sudo node (TO FIX THIS - NODE DOES NOT NEED SUDO!!) | |
sudo ln -s /opt/node/bin/node /usr/bin/node | |
sudo ln -s /opt/node/lib/node /usr/lib/node | |
sudo ln -s /opt/node/bin/npm /usr/bin/npm | |
sudo ln -s /opt/node/bin/node-waf /usr/bin/node-waf | |
#Test | |
node -v | |
npm -v |
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
#!/bin/bash | |
## Check for versions compiled with ARM at http://nodejs.org/dist/ | |
## Inspired by http://oskarhane.com/raspberry-pi-install-node-js-and-npm/ | |
## Fill in the Node Version here: | |
########################################################################## | |
NODE_VERSION="v0.10.28" | |
########################################################################## | |
echo 'export PATH=$HOME/opt/node/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
#Make a new dir where you'll put the binary | |
mkdir -p ~/opt/node | |
#Get it | |
wget http://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-arm-pi.tar.gz | |
#unpack | |
tar xvzf node-${NODE_VERSION}-linux-arm-pi.tar.gz | |
#Copy to the dir you made as the first step | |
cp -r node-${NODE_VERSION}-linux-arm-pi/* ~/opt/node | |
#Add node to your path so you can call it with just "node" | |
#Add these lines to the file you opened | |
AUTO_SOURCE_BASHRC_TEXT=" | |
if [ -f ~/.bashrc ]; then | |
. ~/.bashrc | |
fi | |
" | |
echo "$AUTO_SOURCE_BASHRC_TEXT" >> ~/.bash_profile | |
#Get correct PATH | |
source ~/.bashrc | |
#Test | |
node -v | |
npm -v |
Hey @myrtleTree33 ,
in the first script could you correct following things please?
NODE_VERSION="v0.10.28"
and there is a mistake in the link - this is why it doesn't work - the correct one is:
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-arm-pi.tar.gz
- Changed node version to v0.10.28
- Changed http to https
- second ${NODE_VERSION} had a typo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just tested it on a RaspberryPi with ARM6.
Worked like a charm!