This is the main repository for the Node.js for Mobile Apps project.
It 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:
- To provide the fixes necessary to run Node.js on mobile operating systems.
- To investigate which features need to be added to Node.js in order to make it a useful tool for mobile app development.
- To diverge as little as possible from nodejs/node and nodejs/node-chakracore, while fulfilling goals (1) and (2).
Binaries for Android and iOS are available at https://github.com/janeasystems/nodejs-mobile/releases.
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.
sudo apt-get install -y build-essential git pythonsudo apt-get install -y curl unzipChoose a location where you want to install the Android NDK and run:
curl https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip -o ndk.zip
unzip ndk.zipIt will create a android-ndk-r15c folder. Save that path for later.
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:
Choose a location where you want to install the Android NDK and run:
curl https://dl.google.com/android/repository/android-ndk-r15c-darwin-x86_64.zip -o ndk.zip
unzip ndk.zipIt will create a android-ndk-r15c folder. Save that path for later.
git clone https://github.com/janeasystems/nodejs-mobile
cd nodejs-mobile
git checkout mobile-masterThe tools/android_build.sh script takes as first argument the Android NDK path (in our case is ~/android-ndk-r15c). 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-r15cWhen done, each built shared library will be placed in out_android/$(ARCHITECTURE)/libnode.so.
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-r15c armStart the build phase:
makeThis will create the Android armeabi-v7a shared library in out/Release/lib.target/libnode.so.
Install Xcode 9 or higher, from the App Store, and then install the Command Line Tools by running the following command:
xcode-select --installThat installs git, as well.
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 cmakegit clone https://github.com/janeasystems/nodejs-mobile
cd nodejs-mobile
git checkout mobile-master./tools/ios_framework_prepare.shThat will configure gyp to build Node.js and its dependencies as static libraries for iOS on the arm64 architecture, using the ChakraCore engine with JIT disabled. It will then copy those libraries into tools/ios-framework/bin/, to be used by the nodeLib.xcodeproj Xcode project.
Open tools/ios-framework/nodeLib.xcodeproj in Xcode and build the project with either a physical device or Generic iOS Device selected as the build target. After building, you can check on Xcode's project browser that a libnode.framework file is created in nodeLib/Products/.
Control click libnode.framework in Xcode and select Show in finder. This will show you where the built libnode.framework is. It should be inside a folder named Debug-iphoneos.
Please see the CONTRIBUTING file in the doc_mobile folder in this source distribution.