Can I compile node js with cordova

Running Node.Js on Android


So I know this has been questioned quite a few times. To be precise, for example in these questions:

  1. Run the NodeJs server in Android
  2. How do I start my node.js project on Android?
    and
  3. NodeJS on IOS / Android

However, each option presented has one problem:

  • I want to run it on my normal device to avoid installing another operating system on my device

  • Work on JXCore was stopped last month and (possibly as a result) I was unable to get it to compile (see jxcore-cordova cannot be installed).

  • The Android port of NodeJ's anode hasn't been processed since 2014 and wasn't really serviced back then anyway
  • The second answer in the second thread I linked to mentions that there is now an official node distribution for Android, but other than a link to the latest version's browse website, I couldn't find any information on how to actually use it
  • I've seen this too, but it seems the device needs to be plugged into a PC (or similar) in order to run the ADB shell commands while I want to build it as a separate app

In the time that has passed since these questions were asked and as the "best option", JXCore now appears to be unusable:
Is there some way to run a node.js application (a server in my case) on an Android device?

If you're wondering why I want this: I created a WebApp with a Node.Js server and now I want a version that you can start locally from your phone without the need for an internet connection. This means the server needs to be running on an Android phone.






Reply:


I just had a breathtaking moment - Termux lets you install NodeJS on an Android device!

It seems to work for a basic websocket speed test that I had on hand. The http provided by it can be accessed both locally and in the network.

There is a middle post that explains the installation process

Basically: 1. Install Termux 2. Install apt nodejs 3. Node!

One limitation I encountered: it seems that the shared folders do not have the necessary permissions to install modules. It could just be a file permissions thing. The private app storage works fine.







Dory - node.js

Great new application you
no need to root your phone and can run your js file from anywhere.

  • node.js runtime (run ES2015 / ES6, ES2016 Javascript and node.js APIs in Android)
  • API documents and instant code are executed by doc
  • Syntax highlighting code editor
  • npm supported
  • Linux terminal (Toybox 0.7.4). Command node.js REPL and npm in shell (add '--no-bin-links' option when running npm in / sdcard)
  • StartOnBoot / LiveReload
  • native node.js binary and npm are included. You don't have to be online.

Update instruction on node js 8 (wait asynchronously)

  1. Download and extract the Arm zip file node.js v8.3.0.

  2. Copy 'Node' to the SD card of Android (/ sdcard or / sdcard / path / to / ...)

  3. Open the shell (check it out in the app's menu)

  4. cd /data/user/0/io.tmpage.dorynode/files/bin (or just enter cd && cd .. && cd files / bin)

  5. rm knot

  6. cp / sdcard / node.

  7. (chmod a + x node

(https://play.google.com/store/apps/details?id=io.tempage.dorynode&hl=de)






You can Use Node.js for mobile apps .

It works on Android devices and simulators with pre-built binaries for armeabi-v7a, x86, arm64-v8a, x86_64. It works on iOS too, although that's outside the scope of this question.

Like JXcore, it is used to host a Node.js engine in the same process as the app on a dedicated thread. In contrast to JXcore, it is basically pure Node.js, which was created as a library and contains some portability fixes for Android. This means that it is much easier to keep the project up to date with mainline Node.js.

Plugins for Cordova and React Native are also available. The plugins provide a communication layer between the JavaScript side of these frameworks and the Node.js side. They also make development easier by automatically taking care of a few things, such as: B. module packaging and cross-compiling native modules at build time.

Full disclosure: I work for the company that makes Node.js for mobile apps.








We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.