Node is now updated to 0.10.1 version: following this simple guide you can easy install the latest Node version into your Acme Systems Aria G25 board. Let’s go to see how to install Node 0.10 on ARM based board.
1. Update Debian
The first step is the Debian updating to use new gcc compiler: see my guide to upgrade Debian Squeeze to Wheeze on your Aria G25 board.
2. Install prerequisites
Follow the steps from 1 to 3 on my previous guide.
3. Customize nvm
Edit nvm.sh:
debarm:~# nano nvm.sh
if ( [ ! -z $tarball ] && \ mkdir -p "$NVM_DIR/src" && \ cd "$NVM_DIR/src" && \ curl --progress-bar $tarball -o "node-$VERSION.tar.gz" && \ if [ "$sum" = "" ]; then : ; else nvm_checksum `${shasum} node-$VERSION.tar.gz | awk '{print $1}'` $sum; fi && \ tar -xzf "node-$VERSION.tar.gz" && \ cd "node-$VERSION" && \ ./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \ make && \ rm -f "$NVM_DIR/$VERSION" 2>/dev/null && \ make install ) then
adding the highlighted line:
if ( [ ! -z $tarball ] && \ mkdir -p "$NVM_DIR/src" && \ cd "$NVM_DIR/src" && \ curl --progress-bar $tarball -o "node-$VERSION.tar.gz" && \ if [ "$sum" = "" ]; then : ; else nvm_checksum `${shasum} node-$VERSION.tar.gz | awk '{print $1}'` $sum; fi && \ tar -xzf "node-$VERSION.tar.gz" && \ read -p "Please customize $NVM_DIR/src/node-$VERSION/deps/v8/src/arm/macro-assembler-arm.cc and press [Enter]..." && \ cd "node-$VERSION" && \ ./configure --prefix="$NVM_DIR/$VERSION" $ADDITIONAL_PARAMETERS && \ make && \ rm -f "$NVM_DIR/$VERSION" 2>/dev/null && \ make install ) then
4. Install Node from source code
If you have customized your nvm.sh file open your terminal and type:
debarm:~# nvm install v0.10.1 ######################################################################## 100.0% Checksums do not match. Binary download failed, trying source. Additional options while compiling: ######################################################################## 100.0% Please customize /root/.nvm/src/node-v0.10.1/deps/v8/src/arm/macro-assembler-arm.cc and press [Enter]...
Customize now the macro-assembler-arm.cc file:
debarm:~# nano .nvm/src/node-v0.10.1/deps/v8/src/arm/macro-assembler-arm.cc
adding the highlighted lines:
// We always generate arm code, never thumb code, even if V8 is compiled to // thumb, so we require inter-working support #if defined(__thumb__) && !defined(USE_THUMB_INTERWORK) #error "flag -mthumb-interwork missing" #endif #if !defined(CAN_USE_THUMB_INSTRUCTIONS) # define CAN_USE_THUMB_INSTRUCTIONS 1 #endif // We do not support thumb inter-working with an arm architecture not supporting // the blx instruction (below v5t). If you know what CPU you are compiling for // you can use -march=armv7 or similar. #if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS) # error "For thumb inter-working we require an architecture which supports blx" #endif
Now press Enter and wait. After a few hours (be patient!) you have compiled the latest Node version and you must use it:
debarm:~# nvm use v0.10.1
Done! Now you can verify all:
debarm:~$ node -v debarm:~$ npm -v
If all versions appear, you can install your desired Node packages using npm as you know:
debarm:~$ npm install express
You can also set the default Node version as follow:
debarm:~$ nvm alias default v0.10.1
Good programming with Node!
UPDATE: If you are interested to cross-compile Node please see my latest post.
Arm , Node.js
About Marcello Gesmundo
I'm the founder of Yoovant company. I'm an engineer and an artist: what could be better than combine the technologies with the arts?
Hi Marcello,
first of all thank you so much for your step by step guide.
I’m really a newbie on Aria G25 and on Linux embedded too. I’m trying to compile node.js following your instructions. I’m stuck at the step in this page. I modify the macro-assembler-arm.cc file according to your instructions (double checked), launch “nvm install v0.10.1″ and, after a while, it replays:
error: #error “For thumb inter-working we require an architecture which supports blx”
make[1]: *** [/root/.nvm/src/node-v0.10.1/out/Release/obj.target/v8_base/deps/v8/src/arm/macro-assembler-arm.o] Error 1
make[1]: Leaving directory `/root/.nvm/src/node-v0.10.1/out’
make: *** [node] Error 2
nvm: install v0.10.1 failed!
After that the macro-assembler-arm.cc file is back at its original version, no more correction.
Is it overwritten by the installation procedure? How can I avoid this?
Thank you in advance
Guido Ottaviani
Hi Guido,
to customize macro-assembler-arm.cc file you must use two terminal sessions.
Open the first terminal session and type:
When you see the prompt:
open the second terminal session and customize the .nvm/src/node-v0.10.1/deps/v8/src/arm/macro-assembler-arm.cc file (adding the lines from 60 to 62) then save and close this session, go to the first session and press [Enter].
Feel free to post again in case of difficulty.
Best regards,
Marcello
Thank you Marcello for your prompt replay.
I’l try that ASAP.
ciao
Pingback: Building Node.js on Debian ARM | TechFindings
Hi again Marcello,
Another issue. Something I’m doing wrong.
In step 4 this error appens. Do you know what it is?
ariag25:~/nvm# ./nvm.sh install v0.10.1
./nvm.sh: 12: ./nvm.sh: Bad substitution
./nvm.sh: 78: ./nvm.sh: [[: not found
./nvm.sh: 78: ./nvm.sh: [[: not found
ariag25:~/nvm# ./nvm.sh: 132: ./nvm.sh: [[: not found
-e
N/A
ariag25:~/nvm#
Thanks
Hi Maadaf,
you do not have properly installed nvm:
Next you must apply the small patch as described here: http://www.yoovant.com/install-node-0-10-on-arm-based-board/
For a detailed guide to nvm please read https://github.com/creationix/nvm.
Regards,
Marcello
It work well.
Thank you for your tips.