Skip to content

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

@JCMais

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.

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