androidnode.jscordovaandroid-ndkjxcore

Running Node.Js on Android


So I know this has been questioned quite a lot. To be exact for example in these questions:

  1. Run NodeJs server in Android
  2. How to run my node.js project on android?
    and
  3. NodeJS on IOS/Android

Every option presented has a problem though:

With the time that past since these questions have been posted and as the "best option" JXCore seem to be now unusable:
Is there a way to run a node.js application (a server in my case) on an Android device?

if you're wondering why I'd want this: I made a WebApp with a Node.Js server and I now want a version you can launch locally from your phone without requiring an Internet connection. This means the server needs to run on an Android phone.


Solution

  • I just had a jaw-drop moment - Termux allows you to install NodeJS on an Android device!

    It seems to work for a basic Websocket Speed Test I had on hand. The http served by it can be accessed both locally and on the network.

    There is a medium post that explains the installation process

    Basically: 1. Install termux 2. apt install nodejs 3. node it up!

    One restriction I've run into - it seems the shared folders don't have the necessary permissions to install modules. It might just be a file permission thing. The private app storage works just fine.