Skip to content

node-pre-gyp support in the same way than prebuild is supported #367

Closed

Description

@JCMais

@MarshallOfSound @malept pinging you folks as you are the most recent contributors, sorry to bother with this, but after looking for a similar solution I found this PR which was not accepted: #170.

node-pre-gyp does allow you to have prebuilt binaries for electron, just like prebuilt. For a working example, see the assets on this release: https://github.com/JCMais/node-libcurl/releases/tag/v2.1.2-1

The trick is that to make it use the correct prebuilt binary some arguments / environment variables must be passed with the npm install / yarn install command, like:

# npm
npm install node-libcurl --runtime=electron --target=v8.2.5 --disturl=https://www.electronjs.org/headers --save

# yarn
npm_config_runtime=electron npm_config_target=v8.2.5 npm_config_disturl=https://www.electronjs.org/headers yarn add node-libcurl

If those flags are not passed the prebuilt binary for the current Node.js version is going to be downloaded, and then later when electron-rebuild is called the addon is built from source, instead of trying to use the prebuilt binary for Electron.

Is the project willing to accept a PR that adds support to it? There is no need to bring the whole node-pre-gyp dependency itself as the linked PR did, as the process should be similar to the one used to support prebuild:
https://github.com/electron/electron-rebuild/blob/c42d6c7ed3ea07b6203a686ccdbfbae6bd5f8b5f/src/rebuild.ts#L295-L336

There are multiple related issues on this repo about node-pre-gyp support, the most recent one is this one:
#309

I should be able to dedicate some time to this PR, but I need to know if there is any possibility of it being accepted.

Activity

  1. liSong5713 commented on Sep 14, 2021

    @liSong5713

    When publish this release for support node-pre-gyp?

  2. malept commented on Sep 14, 2021

    @malept
    Member

    There is no timeline. node-pre-gyp is complicated because there are multiple modules which implement it (the deprecated node-pre-gyp, the replacement @mapbox/node-pre-gyp, and any forks), which may or may not have different behavior.

  3. liSong5713 commented on Sep 14, 2021

    @liSong5713
  4. gpetrov commented on Oct 3, 2022

    @gpetrov

    the @mapbox/node-pre-gyp is the new official node-pre-gyp, so can we make it compatible with it? @malept

  5. continuous-auth commented on Aug 21, 2023

    @continuous-auth

    🎉 This issue has been resolved in version 3.3.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions