Can nodejs be installed via nave on your raspberry ?
Does node 0.10.x is working fine when installed this way ?
2 Answers 2
I have not used it on the pi, but there's a node binary in the raspbian repository:
» apt-cache show nodejs
Package: nodejs
Version: 0.6.19~dfsg1-6
Architecture: armhf
Maintainer: Debian Javascript Maintainers <[email protected]>
You should be able to install this very easily with apt-get install nodejs
. The version is more than 6 months old, however.
If that isn't good enough, the node.js crew themselves appear to maintain more recent versions pre-compiled for the pi:
Currently, the "latest" version links to 0.10.3, for which there is no pi binary. However, there's one for 0.10.2, and there's also one for 0.11.0. Nodejs follows an odd/even version numbering meaning the odd minor numbers are the development branch and the even ones the stable branch. Most people will want the stable.
Those tarballs contain a directory tree:
bin/
lib/
share/
You can unpack this into /usr/local/
on the pi. As root (or with sudo):
mv node-v0.10.2-linux-arm-pi.tar.gz /usr/local/src
tar -xzvf node-v0.10.2-linux-arm-pi.tar.gz
cd /usr/local/src/node-v0.10.2-linux-arm-pi
mv bin/* ../../bin/
mv lib/* ../../lib/
Check if you have a /usr/local/share/man/man1, and if not:
mkdir -p /usr/local/share/man/man1
Once that's there:
mv share/man/man1/* ../../share/man/man1/
Done. Check:
> file /usr/local/bin/node
node: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.1.10, not stripped
Should work, and it does; node
on the command line acts as a javascript interpreter. If you've already used node on linux you are good to go. If not, you do not need to use a pi centric tutorial, the oodles that apply to linux generally should be fine. However, worth mentioning is this blog post about setting up a node server to run as a boot service, etc, specifically for the pi. Note that the author of that installs into a dedicated /opt/node
directory and not /usr/local
.
-
I've used this link blog.rueedlinger.ch/2013/03/raspberry-pi-and-nodejs-basic-setup, it explains how to install the binaries.Luc– Luc2013年04月09日 06:01:58 +00:00Commented Apr 9, 2013 at 6:01
-
@Luc : Hey that's great, I've added some stuff about that.goldilocks– goldilocks2013年04月09日 09:21:15 +00:00Commented Apr 9, 2013 at 9:21
Node.js can be installed on the Pi.
I am not sure about your second question though, I will edit this answer as more info comes up.
This is how you do it:
First we need to download the SSL dev libraries.
sudo apt-get install libssl-dev
Now we need to download the latest stable release of Node.js
wget http://nodejs.org/dist/v0.6.15/node-v0.6.15.tar.gz tar -xf node-v0.6.15.tar.gz cd node-v0.6.15 export CCFLAGS='-march=armv6' export CXXFLAGS='-march=armv6'
We will use the
nano
text editor to edit a file.nano deps/v8/SConstruct
Edit lines 82 and 83 to match the following:
'all': { 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv6'], 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions', '-march=armv6'], },
Then comment out lines 157 - 162
Now comes the longest step.
make make install
Lastly, do write this in the terminal:
pacman -S nodejs
That should install node.js
I have not tested it, but it should work. Here is my source.
-
Thanks for this solution, I'll try it. I hope the automated installed using nave will be available soon on raspberry though :)Luc– Luc2013年04月06日 11:40:39 +00:00Commented Apr 6, 2013 at 11:40
-
1Latest node is 0.10.xgoldilocks– goldilocks2013年04月06日 18:34:59 +00:00Commented Apr 6, 2013 at 18:34
-
Also: Looks like node maintains binaries for the pi in that nodejs.org/dist repository, so you don't have to compile it from source (unless you want to).goldilocks– goldilocks2013年04月09日 09:25:51 +00:00Commented Apr 9, 2013 at 9:25