question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose napi version as a node-gyp variable

See original GitHub issue

For 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:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
bnoordhuiscommented, May 16, 2019

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.

0reactions
bnoordhuiscommented, Jun 20, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found