Expose napi version as a node-gyp variable
See original GitHub issueFor my module I want to do conditional compilation based on node-gyp feature support.
Unfortunately there’s currently no nice way to figure out at node-gyp configuration time which napi version is supported. I’m currently doing this:
'variables': {
'napi_version': '<!(node -e "console.log(process.versions.napi)")',
},
But this checks napi support in the host version of nodejs, not in the nodejs build target version.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Solving common issues with node-gyp - LogRocket Blog
Many node-gyp issues are actually issues with the toolchain used for building add-on code. We'll categorize these issues to offer solutions.
Read more >Node-API | Node.js v19.3.0 Documentation
js. It is intended to insulate addons from changes in the underlying JavaScript engine and allow modules compiled for one major version to...
Read more >Docker Node Alpine Image Build Fails on node-gyp
I'd like to be able to run the application from with a Docker container, but I need to get the image to build...
Read more >Building Modern Native Add-ons for Node.js in 2020 - Medium
N-API provides an ABI-stable API that can be used to develop native add-ons for Node.js, simplifying the task of building and supporting such ......
Read more >Node API - Understanding and using environment variables
I realise in the video I spelt environment wrong, but what can you do these things happen . Its not a big deal....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
node-gyp isn’t the right place to embed that logic. If node exposes a
napi_build_version
through its common.gypi, node-gyp will automagically make it available to add-ons. I suggest moving this to nodejs/node.There’s an open pull request over at nodejs/node that is this close to landing so I’ll go ahead and close out this issue.