I'm running Raspbmc which is running a minimal Linux distribution based on Debian. And I would like to install node.js via package manager but I'm fail to install on my system. Which it come with this error.

In file included from /usr/include/linux/kernel.h:4:0,
                 from /usr/include/arm-linux-gnueabihf/sys/sysinfo.h:25,
                 from ../deps/uv/src/unix/linux-core.c:34:
/usr/include/linux/sysinfo.h:8:2: error: unknown type name '__kernel_long_t'
/usr/include/linux/sysinfo.h:9:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:10:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:11:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:12:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:13:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:14:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:15:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:18:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:19:2: error: unknown type name '__kernel_ulong_t'
/usr/include/linux/sysinfo.h:21:22: error: '__kernel_ulong_t' undeclared here (not in a function)
make[1]: *** [/root/src/node-0.10.21/out/Release/obj.target/libuv/deps/uv/src/unix/linux-core.o] Error 1
make[1]: Leaving directory `/root/src/node-0.10.21/out'
make: *** [node] Error 2

I'm following this step to install node.js

sudo apt-get install python g++ make checkinstall
mkdir ~/src && cd $_
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz
mv node-v0.10.19 node-0.10.19
cd node-0.10.19
checkinstall --install=no
  • There is a Debian package nodejs, which appears to contain node.js. Is there some reason you are not using that? – Faheem Mitha Nov 6 '13 at 16:02
  • @FaheemMitha The stable Debian node.js is very outdated, unfortunately, and there are no other repositories for raspbmc (it has to be compiled for an odd architecture, and only stable is ported). I think the issue is that debian policy is hardcoded WRT the amount of time a package needs to go without uncleared bug reports before it gets moved to stable, and node.js has undergone rapid development in the past few years, so they just can't get a reasonably current version into stable. Hence most people using it on debian probably build it from source. – goldilocks Nov 6 '13 at 16:16
  • It isn't really a node problem, although it demonstrates itself while trying to install node. The platform raspbmc, or underlying parts need to be updated. Uclibc accepted a patch last july to provide that typedef. If I was more familiar with the platform, I could give you specific advice. – JustinC Apr 26 '14 at 13:53

Kind of a strange error, since it's in a system header. I think there are some slightly odd things done WRT libraries and includes on the debian derived raspberry pi distros. If you really really really want a source build, you will probably have better luck cross-compiling, since those eccentricities aren't in the x-tool environment, but the binaries should still work.

Fortunately, you probably don't have to do that either. Node.js maintains a binary package for the pi (among other things) and the 0.10.19 ones are ->HERE<-. You want node-v0.10.19-linux-arm-pi.tar.gz.

You don't need to run configure/make/etc to use that package. It is already compiled for the pi, and links against libraries in raspbian. Here you go:

wget http://nodejs.org/dist/v0.10.19/node-v0.10.19-linux-arm-pi.tar.gz

The tar file is only 5 MB. Now:

tar -xvf node-v0.10.19-linux-arm-pi.tar.gz

That creates a directory, node-v0.10.19-linux-arm-pi. Inside you'll find three directories:


The node binary executable is in bin. I just tried it here on the pi briefly (bin/node) and it worked to execute a few simple js commands, so it is probably all good.1 You can leave everything as is and move it where ever you want, but you probably want to add that bin directory to your $PATH. Eg:

export PATH=/home/pi/node-v0.10.19-linux-arm-pi/bin:$PATH

Add that to ~/.bashrc to make it persistent. If you want to run node as a system service, you'll have to create a script and do some other configuration -- but that is another question.

There's also a symlink to npm, the node package manager, in the bin directory. The /lib directory doesn't need to be in the system library path because it is just node modules, but you probably need to tell node where it is...I have not worked with node in several years and can't help with that.2 The /share directory contains man pages; you may want to copy them appropriately into /usr/share/man if you want to access them normally with man.3 Alternately, you could copy the contents of all three directories into their counter-parts in /usr/local and use it that way.

1 If it doesn't work right away for you, try ldd bin/node. There should be no ?? in the output. I believe all the libraries necessary should already be there except maybe for libstdc++. If that's the problem, just apt-get install libstdc++6.

2 Using and configuring node is not a pi specific task, so if you are looking for help with that, you'll be better off in a more general forum such as: https://stackoverflow.com/ which has a lot of node.js users.

3 There's actually only one man page. You can read it without moving it by specifying the path and filename, e.g. man share/man/man1/node.1.

| improve this answer | |
  • I try to download the arm version but getting same error. I'm following https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager to install node via package manager but failed. – Jien Wai Nov 7 '13 at 15:40
  • Forget about that. This is a total no-brainer, honestly. I did not spell out how to use the binary package from node.js before, but I've gone into detail above -- read the edit that starts "You don't need to run configure/make/etc to use that package..." If there is a problem, post specifically what the problem is. – goldilocks Nov 8 '13 at 14:57
  • REMEMBER, I'm talking about the precompiled package from the link in my answer, NOT the source package or anything else from your question. You don't need that. – goldilocks Nov 8 '13 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.