-
Notifications
You must be signed in to change notification settings - Fork 6
Cross Compile NPM modules
Jesús Darío edited this page Feb 9, 2017
·
5 revisions
In this guide, we will explain how to compile npm modules for any cpu-architecture supported by node js.
We will use the OpenWRT Toolchain. Before continuing, I recommend reading these useful guides:
Listen Up! : Not all npm modules need to be cross compiled.
## PrerequisitesYou will need:
-
OpenWRT tool chain compiled according to your cpu architecture. If you haven't done yet. Go here
-
To have npm installed.
- Firstly, we need to define some global variables:
export CC=/route/to/openwrt/folder/staging_dir/toolchain-name-of-your-architecture-something/bin/your-architecture-gcc
export CXX=/route/to/openwrt/folder/staging_dir/toolchain-name-of-your-architecture-something/bin/your-architecture-g++
export STAGING_DIR=/route/to/openwrt/folder/staging_dir
- Secondly, create a folder for your npm module and run:
cd folder_name
npm --arch=<name> install <npm module>
Note: on some npm versions
--arch=<name>
may change to--target_arch=<name>
- If all went well, you will have your npm module cross-compiled.
Copy the cross compiled npm module to your device and create one app in order to test it.
If there are no errors, you have cross compiled your npm module successfully.
# warning
: now our docs are being published in our gitbook and available on our website. Visit http://docs.netbeast.co/
- Visit our site https://netbeast.co
- Mail us: staff [at] netbeast.co
- Report a bug or enter discussion at issues
- Other resources: Dashboard, Netbeast API