A template repo to build Node.js native addons without node-gyp! Switch to any of your favorite general-prupose build tools. And there's a blog post
Tested on these platform, see actions:
-
Linux:
gcc 12.2.1 + gnu make 4.3
,gcc 12.2.1 + ninja 1.11.1
. -
Windows:
msvc cl 19.34.31938 x64 + nmake
,msvc cl 19.35.32216.1 x64 + ninja 1.11.1
,gcc 12.2.0 + mingw-w64 10.0.0 + ninja 1.11.1
. -
macOS:
clang / llvm 14.0.0
.
cmake -B build -G Ninja && cmake --build build
node src/main.js
On Linux, without any build tools, put node-addon-api and node-api-headers into ./third_party
, then:
mkdir -p build
g++ src/hinapi.cc -o build/hinapi.node \
-I third_party/node-addon-api \
-I third_party/node-api-headers/include \
-shared -fPIC
node src/main.js
https://blog.logrocket.com/solving-common-issues-node-gyp/
https://github.com/evanw/esbuild/blob/v0.17.12/lib/npm/node-platform.ts
https://stackoverflow.com/a/74779719/11338291
https://stackoverflow.com/a/17602173/11338291
https://gist.github.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977
https://github.com/skeeto/w64devkit/
https://github.com/nodejs/node-addon-api/blob/main/doc/setup.md