Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 1.04 KB

File metadata and controls

20 lines (14 loc) · 1.04 KB

nw-node-addon-gyp-example

Build Node Addon using node-gyp.

Approach

  1. Download NW.js Node headers tarball from https://dl.nwjs.io. For example, for headers for v0.99.1 can be downloaded here.
  2. 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
  3. (Re)build Node addons for NW.js: node-gyp rebuild --target=23.11.0 --nodedir=/path/to/node/headers/directory
  4. The compiled addon will be at $PWD/build/Release/{addon_name}.node. For example, if the target value in your binding.gyp file is hello, then the file will be $PWD/build/Release/hello.node.
  5. Import the module inside your application: const { hello } = require('./build/Release/hello');

Note: This approach works from v0.83 onward.

Getting Started with demo application

  1. Clone repo
  2. npm i to install Node modules
  3. npm run gyp to download Node headers and build Node Native Addon
  4. npm run nw to run NW.js app.