3

Yes, the question seems a little bit weird (why to run server on mobile device and not access server via REST service), but still I'd like to get your opinions about it and I really need it to run on the device.

For the moment I found jxcore (https://github.com/obastemur/jxcore-android-basics) which allows running node.js in Android and iOS. But I haven't tested it yet.

So, how one can run node.js in iOS/Android platforms?

Nuray Altin
  • 1,213
  • 12
  • 19
Bakhtiyor
  • 6,580
  • 14
  • 51
  • 76

5 Answers5

3

As of today, there is an alternative to JXcore: Node.js for Mobile Apps, and it's actively maintained.

At its core, the project provides a native library for embedding Node.js into native Android and iOS applications; but it also comes with plugins for React Native and Cordova.

Pre-built binaries for the library are available for Android armeabi-v7a, x86, arm64-v8a, x86_64, and for iOS 64-bit.

The core library is a fork of nodejs/node-chakracore, which in turn is fork of nodejs/node. The Android version is pretty much regular Node.js built as a library, with a few portability fixes. The iOS version uses the ChakraCore engine instead of V8 (replacing V8 with ChakraCore is possible thanks to the changes in the nodejs/node-chakracore fork).

The React Native and Cordova plugins make it easier to add Node.js to applications built using those frameworks. The Node.js code runs in a separate engine and thread than the framework's (React Native / Cordova). Communication between the two JavaScript worlds is achieved via a messaging bridge provided by the plugins.

More information, including some documentation, is available on the project website.

(Full disclosure: I work for the company that develops Node.js for Mobile Apps.)

2

JXcore is a fork of node.js specialized for mobile (android, ios, and wp) and IoTs.. See this blog post for the first node.js mobile application on App Store.

For a starter, read the README for this repository on using node.js with Cordova on mobile. If you google jxcore, and mobile, you should find some tutorials and samples on the web.

BigbangO
  • 820
  • 5
  • 9
  • Unfortunately, JXCore is no longer sponsored by Nubisa who was the primary (only?) corporate sponsor. http://www.nubisa.com/nubisa-halting-active-development-on-jxcore-platform/ – Timothy C. Quinn Jul 19 '16 at 17:28
0

When you download the source, you'll find a android-configure, so it seems at least for Android, it's possible if you compile it yourself. For iOS, I don't know. Someone managed to get it to work on iOS 4 years ago, so it seems it's possible. See also this related question.

The right place to ask this is probably one of the Node.js mailing lists as you will probably need the help of some people deeply involved in Node.js.

If you're targeting the iOS App Store, keep in mind that you are allowed to run interpreters (JavaScript is by definition interpreted), but you are not allowed to run downloaded code. Everything your Node.js runs must be included in the app bundle already.

Community
  • 1
  • 1
DarkDust
  • 85,893
  • 19
  • 180
  • 214
  • The `android-configure` is not working ootb in many occasions. I am investigating current [viable options to running NodeJS on Android (Aug 2017)](https://stackoverflow.com/a/45649995/8295283). – Arnold Schrijver Aug 12 '17 at 15:40
0

There is another alternative: LiquidCore.

LiquidCore enables Node.js virtual machines to run inside Android and iOS apps. It provides a complete runtime environment, including a virtual file system and native SQLite support.

LiquidCore is a full port of node 8.9+ and supports all the bells and whistles.

Eric Lange
  • 1,535
  • 2
  • 17
  • 22
-2

Node.js can be built for ARM, though other solution is better - just using webView as far as it's Chrome-based on Android and Safari-based in iOS.

Jabher
  • 180
  • 4
  • 10