-
Notifications
You must be signed in to change notification settings - Fork 6
Cross Compile NPM modules
Jon Senra Dearle edited this page Oct 30, 2015
·
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
-
One pc with npm installed.
- Firstly, we need to define some global variables like this:
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>
- If all went file, you will have your npm module cross-compiled.
Copy the npm module cross compiled 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