Skip to content

Instantly share code, notes, and snippets.

@ghalusa
Last active February 25, 2020 21:48
Show Gist options
  • Select an option

  • Save ghalusa/5485982 to your computer and use it in GitHub Desktop.

Select an option

Save ghalusa/5485982 to your computer and use it in GitHub Desktop.
Install node.js on a raspberry pi
wget http://nodejs.org/dist/v0.10.5/node-v0.10.5-linux-arm-pi.tar.gz
cd /usr/local
sudo tar xzvf ~/node-v0.10.5-linux-arm-pi.tar.gz --strip=1
vi ~/.bash_aliases
export PATH=$PATH:/usr/local/bin/node
bash
node -v
(v0.10.5)
npm -v
(1.2.18)
@xseignard

Copy link
Copy Markdown

What if you try a sudo npm install mocha -g or any global lib? ;)

I prefer the following

sudo ln -s /path/to/node/folder/bin/node /usr/bin/node
sudo ln -s /path/to/node/folder/bin/npm /usr/bin/npm

What do you think?

@itwars

itwars commented May 7, 2013

Copy link
Copy Markdown

Great way to make it but you can directly use my cross compile vagrant file :

http://www.nodejs-news.com/nodejs-tech/ruby-to-build-nodejs-raspberrypi/

Or get the final .deb package :

https://github.com/itwars/nodejs-ARM

Regards,

@ghalusa

ghalusa commented May 8, 2013

Copy link
Copy Markdown
Author

@xseignard Symbolic links? Unless I misunderstood what you're saying... the way to do it is to have node and npm in your path, or globally.

export PATH=$PATH:/usr/local/bin/node
export PATH=$PATH:/usr/local/bin/npm

@ghalusa

ghalusa commented May 8, 2013

Copy link
Copy Markdown
Author

@itwars nice!

@xseignard

Copy link
Copy Markdown

@ghalusa if you only change the PATH of the logged user, when you do :

vi ~/.bash_aliases
export PATH=$PATH:/usr/local/bin/node

Other users (such as the root one) won't have access to the node and npm binaries. Then, you won't be able to install node module globally (i.e. with sudo).

To convince you, try to do the following after your install method :

sudo npm install -g mocha

or any other module that needs to be installed globally.

That's why I prefer the use of symoblic links.

@ghalusa

ghalusa commented May 8, 2013

Copy link
Copy Markdown
Author

@xseignard You can add paths to /etc/environment to make it global.

sudo vi /etc/environment

@mab-u

mab-u commented Oct 5, 2014

Copy link
Copy Markdown

In this blog post an easy method is described:

wget http://node-arm.herokuapp.com/node_latest_armhf.deb 
sudo dpkg -i node_latest_armhf.deb

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