Skip to content
Full-fledged Node.js on Android and iOS
Branch: mobile-master
Clone or download
Pull request Compare This branch is 3945 commits ahead, 3639 commits behind nodejs:master.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github meta: remove upstream issue template files Jul 10, 2019
benchmark Merge tag 'v10.13.0' into v10.13.0-proposal Nov 15, 2018
deps ios,deps: remove private API symbols from openssl Apr 17, 2019
doc Merge node-chakracore-v10.13.0 Mar 27, 2019
doc_mobile Working on Node.js for Mobile Apps v0.2.2 Apr 23, 2019
lib test, lib: fix rest syntax unsupported in node-chakracore Nov 15, 2018
src Working on Node.js for Mobile Apps v0.2.2 Apr 23, 2019
test test,android: increase delay in performance test Apr 2, 2019
tools test,android: set stdout and stderr line buffered Apr 2, 2019
.clang-format tools: add `make format-cpp` to run clang-format on C++ diffs Aug 4, 2018
.editorconfig tools: unify .editorconfig rules for 2-space Oct 3, 2018
.eslintignore tools: use lint-md.js Sep 11, 2018
.eslintrc.js tools: .eslintrc.js messages "default" typo style Sep 25, 2018
.gitattributes src: limit .gitattributes eol to vcbuild.bat Jan 13, 2015
.gitignore Merge node-chakracore-v10.13.0 Mar 27, 2019
.mailmap doc: update AUTHORS list Sep 20, 2018
.nycrc test: fix tests that fail under coverage May 23, 2018
.travis.yml tools: make Travis commit linting more robust Oct 10, 2018
AUTHORS doc: update AUTHORS list Sep 20, 2018
BSDmakefile node: rename from io.js to node Aug 23, 2015
BUILDING.md doc: edit building-node text Oct 10, 2018
CHANGELOG.md 2018-10-30 Version 10.13.0 'Dubnium' (LTS) Oct 30, 2018
CODE_OF_CONDUCT.md doc: move Code of Conduct to admin repo Nov 28, 2017
COLLABORATOR_GUIDE.md doc: update author-ready label terms Oct 7, 2018
CONTRIBUTING.md doc: add contents table to CONTRIBUTING.md Oct 3, 2018
CPP_STYLE_GUIDE.md doc: formalize `auto` usage in C++ style guide Oct 3, 2018
FAQ.md doc: add a FAQ to the project Sep 3, 2018
GOVERNANCE.md doc: require two approvals to land changes Sep 25, 2018
LICENSE tools: use lint-md.js Sep 11, 2018
Makefile Merge node-chakracore-v10.13.0 Mar 27, 2019
NodeMobile.podspec ios: add podspec to enable use with CocoaPods Dec 26, 2018
README.md Merge node-chakracore-v10.13.0 Mar 27, 2019
TTD-README.md lib,src: enable TTD auto-trace config May 22, 2018
android-configure android: configure project with cross-compiling Apr 1, 2019
common.gypi ios: set CLANG_CXX_LANGUAGE_STANDARD to gnu++1y Apr 1, 2019
configure build: move meta-shebang back to `configure` Sep 7, 2018
configure.py Merge node-chakracore-v10.13.0 Mar 27, 2019
node.gyp Merge node-chakracore-v10.13.0 Mar 27, 2019
node.gypi android,ios: don't build openssl-cli project Apr 1, 2019
vcbuild.bat Merge tag 'v10.13.0' into v10.13.0-proposal Nov 15, 2018

README.md

Node.js for Mobile Apps

This is the main repository for Node.js for Mobile Apps, a toolkit for integrating Node.js into mobile applications.

Resources for Newcomers

This is the central repository for reporting all issues related to the Node.js for Mobile Apps project, including issues pertaining to the React Native and Cordova plugins.

The core library source code is in this repo. If you are looking for the source code for the plugins, you can find it at:

Project Goals

  1. To provide the fixes necessary to run Node.js on mobile operating systems.
  2. To investigate which features need to be added to Node.js in order to make it a useful tool for mobile app development.
  3. To diverge as little as possible from nodejs/node and nodejs/node-chakracore, while fulfilling goals (1) and (2).

Download

Binaries for Android and iOS are available at https://github.com/janeasystems/nodejs-mobile/releases.

Documentation

Documentation can be found on the project website. Sample code is available in the samples repo.

Disclaimer: documentation found in this repository is currently unchanged from the parent repository and may only be applicable to node-chakracore.

Build Instructions

Prerequisites to build the Android library on Linux Ubuntu/Debian:

Basic build tools:

sudo apt-get install -y build-essential git python

Install curl and unzip (needed to download the Android NDK):

sudo apt-get install -y curl unzip

Install Android NDK r18b for Linux:

Choose a location where you want to install the Android NDK and run:

curl https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip -o ndk.zip
unzip ndk.zip

It will create a android-ndk-r18b folder. Save that path for later.

Prerequisites to build the Android library on macOS:

Git:

Run git in a terminal window, it will show a prompt to install it if not already present. As an alternative, installing one of these will install git:

Install Android NDK r18b for macOS:

Choose a location where you want to install the Android NDK and run:

curl https://dl.google.com/android/repository/android-ndk-r18b-darwin-x86_64.zip -o ndk.zip
unzip ndk.zip

It will create a android-ndk-r18b folder. Save that path for later.

Building the Android library on Linux or macOS:

1) Clone this repo and check out the mobile-master branch:

git clone https://github.com/janeasystems/nodejs-mobile
cd nodejs-mobile
git checkout mobile-master

2a) Using the Android helper script:

The tools/android_build.sh script takes as first argument the Android NDK path (in our case is ~/android-ndk-r18b). The second argument is optional and is the target architecture, which can be one of the following: arm, x86, arm64 or x86_64. If no target architecture is provided, it will build all available architectures. Run:

./tools/android_build.sh ~/android-ndk-r18b

When done, each built shared library will be placed in out_android/$(ARCHITECTURE)/libnode.so.

2b) Configure and build manually:

Run the android-configure script to configure the build with the path to the downloaded NDK and the desired target architecture.

source ./android-configure ../android-ndk-r18b arm

Start the build phase:

make

This will create the Android armeabi-v7a shared library in out/Release/lib.target/libnode.so.

Prerequisites to build the iOS .framework library on macOS:

Xcode 9 with Command Line Tools

Install Xcode 9 or higher, from the App Store, and then install the Command Line Tools by running the following command:

xcode-select --install

That installs git, as well.

CMake

To install CMake, you can use a package installer like Homebrew.

First, install HomeBrew, if you don't have it already.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then, use it to install CMake:

brew install cmake

Building the iOS library using CocoaPods:

Add this to your Podfile:

pod 'NodeMobile', :git => 'https://github.com/janeasystems/nodejs-mobile.git'

Building the iOS .framework library on macOS:

1) Clone this repo and check out the mobile-master branch:

git clone https://github.com/janeasystems/nodejs-mobile
cd nodejs-mobile
git checkout mobile-master

2) Run the helper script:

./tools/ios_framework_prepare.sh

That will configure gyp to build Node.js and its dependencies as static libraries for iOS on the arm64 and x64 architectures, using the ChakraCore engine with JIT disabled. The script copies those libraries to tools/ios-framework/bin/arm64 and tools/ios-framework/bin/x64, respectively. It also merges them into static libraries that contain strips for both architectures, which will be placed in tools/ios-framework/bin and used by the tools/ios-framework/NodeMobile.xcodeproj Xcode project.

The helper script builds the tools/ios-framework/NodeMobile.xcodeproj Xcode project into three frameworks:

  • The framework to run on iOS devices: out_ios/Release-iphoneos/NodeMobile.framework
  • The framework to run on the iOS simulator: out_ios/Release-iphonesimulator/NodeMobile.framework
  • The universal framework, that runs on iOS devices and simulators: out_ios/Release-universal/NodeMobile.framework

While the universal framework is useful for faster Application development, due to supporting both iOS devices and simulators, frameworks containing simulator strips will not be accepted on the App Store. Before trying to submit your application, it would be advisable to use the Release-iphoneos/NodeMobile.framework in your submission archive or strip the x64 slices from the universal framework's binaries before submitting.

Running tests

Please see the TESTING.md file in the doc_mobile folder in this source distribution.

Contributing

Please see the CONTRIBUTING file in the doc_mobile folder in this source distribution.

You can’t perform that action at this time.