NodeJS on Android [Root]

I created this guide to explain some things about running Node on Android. We will go over how to get up and running with Javascript and Node on Android. When I originally tried to find information on this I found it hard to come up with anything solid so I thought I would share my findings here!

Why Would You Want to Run Node / Javascript on Android?

The reason I originally looked into this was that I had a WebRTC application that needed a signaling server and I wanted to run it on the embedded system so I wouldn’t need a second computer. Another use case might be that you have a bunch of code written in Javascript and you want to leverage that on Android. Adding Node to the embedded Android toolkit is a huge bonus as well since there are a lot of problems that can easily be solved using it.

Download Node

The first thing that will be required to run any Javascript natively on Android will be Node, the way we can get Node for Android is to download a pre-compiled binary. You will need one that will run on the CPU architecture that your android device has. In my case, I will be using a Snapdragon 820 dev kit so I’ll be getting an arm64 binary. If you are unsure of what version you need I would start with arm and if that doesn’t work try x86. You can download the binary you need from GitHub here. I recommend just downloading the single file from the browser since it is a lot of precompiled binaries to clone the entire repo.

Install the Binary on the Android Device

To use the Node binary, we will need to push it to our device and add execute permissions. The best way to do this is over ADB, if you are unfamiliar with ADB it is beyond the scope of this tutorial however a great place to find information on it would be the documentation here.

Once you download the appropriate binary for your device it’s time to push it to the device. For the sake of this guide, I will be installing it in the system partition so it will directly accessible from the shell. However you can place it wherever you like but you will need to call it with a fully qualified path.

Remounting System

We need to remount /system as r/w so we can push the binary, you can achieve this with the following command.

adb remount

Pushing the Binary

Next, we need to push the binary to the device, you will need to change the source folder to point to the location that you downloaded the Node binary earlier.

adb push "E:\sourcetree\nodejs-android-prebuilt-binaries\nodejs-7.8.0-android-arm64-full\bin\node" /system/bin

Updating Permissions

Finally, to use it we will need to change the permissions to allow execution.

adb shell "chmod +x /system/bin/node"

Hello World from Javascript

To test the Node binary we will do a simple version check in the system, run the following command, if it doesn’t return a version number either you have the wrong binary or something else is wrong.

adb shell “node -v”

For fun let’s create a simple hello world in javascript and execute it on the system. You will need to have a folder on the device that you are using to store the Javascript files, for the remainder of the tutorial I will be using /data/local/tmp however you can use whatever folder you want.

Creating the JavaScript File

You can create a hello world in Javascript in just one line so let’s just create it using ADB shell. First we’ll need to enter the shell and then call the echo command once we’re in (You should see a # or $ at the prompt).

adb shellecho "console.log('Hello Android!');" > /data/local/tmp/


To execute the file simply call Node the same way you would on a Linux computer. Also if you installed Node to a different location don’t forget to call it using a fully qualified path.

node /data/local/tmp/

If everything went correctly you should see the text “Hello Android!” in the output! Great, let’s take it to the next level.

Launching a Full Express Server on Android

Let’s launch an Express server on our device, for this part of the guide we will need the files for the express server. I’ll be using ProjectRTC which is a WebRTC signaling server built on Node using Express. You can download the source here.

Installing Node Packages

You will need to download the Node packages locally so you will need to have NPM installed on your computer since the Android device doesn’t have NPM and can’t download the required packages.

To install the Node packages you will need to cd into the folder that contains the package.json file in the root of the project and then execute the following command.

npm i

Once that command completes you should see a node_modules folder with thousands of files in it. Now we need to push all the contents of the root project folder to the device, again I’ll be using /data/local/tmp but feel free to place it anywhere you like.

Pushing the Files

My project folder is located at E:\sourcetree\ProjectRTC however you will need to change this to point to your folder, also this might take a while so feel free to get a snack while it copies.

adb push "E:\sourcetree\ProjectRTC" "/data/local/tmp"


And you can launch it with

adb shell "node /data/local/tmp/ProjectRTC/app.js"

If you see the text “Express server listening on port 3000” it means it’s working!


There you have it, you just launched Javascript code on an Android device. Now you can turn your phone into a fully-fledged webserver if you like! (Although I wouldn’t recommend it)

Thanks for taking the time to read this, I hope you found it helpful. If you did please consider applauding, sharing or following for more content. If you have any questions or comments don’t hesitate to reach out on LinkedIn.

If you enjoyed this guide you might like my similar articles Python on Android and GoLang on Android!

About the author

My name is Aaron Watson and I’m a Canadian Software Developer with years of experience in embedded Android development.




I’m a Full Stack Developer from Canada specializing in React, React-Native, Flask, and Apollo.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Intro to Peg.js

How I developed Apple’s Screen time Chrome Extension

Quickie Dev #10: Some util JS tools & code snippets

How to make a Promise out of a Callback function in JavaScript

Build a Bare Minimum Express.js Server in 5 minutes

Component First Development with Next.js

Logical CSS with Simple Styled Components Mixins

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aaron Watson

Aaron Watson

I’m a Full Stack Developer from Canada specializing in React, React-Native, Flask, and Apollo.

More from Medium

Firebase user count per provider

GraphQL Mutations and Caching using Apollo Client

A Quick Comparison between React Native Apps vs Native Apps(Android/iOS).

Firestore Pagination with Realtime Updates — Android

Firestore pagination with realtime updates by Ankur Gupta