Sunday, 20 May 2018

how to run node.js on Android

I mainly use node.js since one year ago at work, and I really like it.
On my work project, I have to create a system which uses, but I don't have enough time to re-create a system using Android Java.
But I finally figure out how to run node.js on Android.

* This is really advanced topic, so I don't aim for Android beginners. Just for my memo.

1. Rooted your Android

First of all, you have to obtain root permission of your Android.
There are many ways and it's depends on your Android.
Ask to google.

2. Install Debian kit for Android

Debian kit for Android is really awesome tool.
You can install Debian onto your Android.
Download from Google Play store, then follow the instruction.

Debian kit for Android


$> cd /data/local/tmp
$> wget
$> sh debian-*
... (after the set up)
$> deb  // start debian
#> apt-get update
#> apt-get upgrade
#> apt-get install andromize
#> apt-get install sudo
... (install another packages if you want)

3. Install node.js

Before install node.js, you also need couple of debain packages.
#> apt-get install openssl build-essential python libssl-dev git-core
To install node.js for Debian, you might need to compile node.js from source code. 
#> cd /data/local/tmp
#> wget
#> tar zxf node-latest.tar.gz
#> cd node*
#> ./configure
#> make
#> make install

If your Android uses ARM architecture, you might be get couple of errors.
To prevent these, add couple of parameters.
#> ./configure --without-snapshot --dest-cpu=arm --dest-os=linux

Snapshot is a technology to run node.js quickly on V8 engine.
But there are bugs for ARM architecture, so you should disable snapshot.

Also you might face an error with "For thumb inter-working we require an architecture which supports blx".
Then get rid of the error code in the macro.
It doesn't affect (at least for me)



Now node.js should run on your Android.

#> node -e "console.log('Hello Node.js on Android')"

1 comment:

  1. These web sites have allowed larger social interaction between users, creating communities devoted Kitchen Mittens to 3D printing. ARC 3D models are created utilizing the most superior 3D printers obtainable today. Many companies who buy 3D printers for onsite use discover that solely some of their wants are met by it and that it typically finally ends up too costly to remain on the forefront of emerging tech. With ARC’s 3D printing providers, you gain entry to the newest technology in 3D printing when you want it with out the overhead of an onsite fleet of printers.