Build Node Addon using node-gyp.
- Download NW.js Node headers tarball from https://dl.nwjs.io. For example, for headers for v0.99.1 can be downloaded here.
- Get the Node version used by the NW.js release version from https://nwjs.io/versions.json. For example, for v0.99.1 the Node version is 23.11.0
- (Re)build Node addons for NW.js:
node-gyp rebuild --target=23.11.0 --nodedir=/path/to/node/headers/directory - The compiled addon will be at
$PWD/build/Release/{addon_name}.node. For example, if thetargetvalue in yourbinding.gypfile ishello, then the file will be$PWD/build/Release/hello.node. - Import the module inside your application:
const { hello } = require('./build/Release/hello');
Note: This approach works from v0.83 onward.
- Clone repo
npm ito install Node modulesnpm run gypto download Node headers and build Node Native Addonnpm run nwto run NW.js app.