desktopdan
Posts: 10
Joined: Mon Apr 21, 2014 8:29 pm

cannot install nodejs

Sat Dec 06, 2014 9:43 pm

I have spent a few hours bashing my head against this wall.

i have been trying to install nodejs on my raspberry Pi.

I do sudo apt-get install -y nodejs

It appears to work and install the packages. But when I try

node -v
nodejs -v
npm -v

I get "Segmentation Error" back, and nothing else.

I tried apt-get update and apt-get upgrade and then re-installed node, but nothing.

I am a bit of a noob, so have now run out of ideas. Any suggestions?

Many thanks

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: cannot install nodejs

Sun Dec 07, 2014 9:07 am

It's better to to install node.js from packages fetched from nodejs.org. They are nice enough to provide ready made packages for the raspberry pi.

The latest release of node is v0.10.33 but the latest release in the 0.10.x series for the pi is 0.10.28 which can be found here: http://nodejs.org/dist/v0.10.28/

Development continues of course so in the 0.11.x series the latest version for the Pi is 0.11.12 available here:http://nodejs.org/dist/v0.11.12/

Sometimes I have had issues with using the newest stuff so 0.10.28 is probably a good place to start.
Memory in C++ is a leaky abstraction .

desktopdan
Posts: 10
Joined: Mon Apr 21, 2014 8:29 pm

Re: cannot install nodejs

Sun Dec 07, 2014 4:22 pm

Many thanks. I will try that! Just to be clear - do I download and install http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
or http://nodejs.org/dist/v0.10.28/node-v0 ... -pi.tar.gz

I downloaded the latter, but it did not have a ./configure file, so I did not know what to do with it.

Are you saying that by downloading and installing the node-v0.10.28.tar.gz version, I get a the pi version as part of it?

thanks

Daniel

desktopdan
Posts: 10
Joined: Mon Apr 21, 2014 8:29 pm

Re: cannot install nodejs

Sun Dec 07, 2014 7:47 pm

Actually, ignore the above. I went for http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
and it worked!
It did take 2+ hours to install but I am there!
Onwards and upwards!

Many thanks!!

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: cannot install nodejs

Sun Dec 07, 2014 8:34 pm

Sorry, I should have been clearer. The node packages like node-v0.11.11-linux-arm-pi.tar.gz are prebuilt binaries. You only have to unpack them and they are ready to run. Instructions are in the README.md file like:

Code: Select all

The tarballs are self-contained; you can extract them to a local directory
with:
    tar xzf /path/to/node-<version>-<platform>-<arch>.tar.gz
Or system-wide with:
    cd /usr/local && tar --strip-components 1 -xzf  /path/to/node-<version>-<platform>-<arch>.tar.gz
Never mind, compiling from source is slow but it's good for the soul and you will have learned a thing or too along the way.

I'm curious to know what your plans for node.js on the Pi are.
Memory in C++ is a leaky abstraction .

Return to “Other programming languages”