Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use nodeGyp option #230

Merged
merged 4 commits into from
Mar 7, 2025
Merged

feat: use nodeGyp option #230

merged 4 commits into from
Mar 7, 2025

Conversation

wraithgar
Copy link
Member

@wraithgar wraithgar commented Mar 5, 2025

This allows for a nodeGyp option to be passed in to define where the node-gyp bin is to run.

It also allows for the environment variable npm_config_node_gyp to already be set, and not override it if it is.

This is an extension of #222

Closes: npm/cli#2839

Co-author: @legobeat

@wraithgar

This comment was marked as outdated.

npm_config_node_gyp = env.npm_config_node_gyp
} else {
// default
npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we built a safeguard in here in case require.resolve wasn't available we'd still need this to throw if this default was needed and failed, so it's effectively a NOP. If you need this code to work in an environment that doesn't have require.resolve you can pass in the option or set the environment variable.

@wraithgar
Copy link
Member Author

wraithgar commented Mar 5, 2025

We also need to go dive into npm/cli#8129 and make sure that flatOptions make it here like we expect.

ETA: that PR now has the fix that makes sure this package gets npm's node-gyp config. https://github.com/npm/cli/pull/8129/files#diff-80c79142b1459e30b4b4cd64826d26a15fe1e0be8459290ad45eb7371c47e69cR350

@wraithgar wraithgar marked this pull request as ready for review March 5, 2025 17:20
@wraithgar wraithgar requested a review from a team as a code owner March 5, 2025 17:20
@wraithgar wraithgar merged commit 21694f2 into main Mar 7, 2025
5 checks passed
@wraithgar wraithgar deleted the gar/node-gyp-env branch March 7, 2025 16:42
@github-actions github-actions bot mentioned this pull request Mar 7, 2025
wraithgar pushed a commit that referenced this pull request Mar 7, 2025
🤖 I have created a release *beep* *boop*
---


## [9.1.0](v9.0.2...v9.1.0)
(2025-03-07)
### Features
*
[`21694f2`](21694f2)
[#230](#230) use nodeGyp option
(#230) (@wraithgar, @legobeat)
### Chores
*
[`fea1ba3`](fea1ba3)
[#229](#229) bump
@npmcli/template-oss from 4.23.4 to 4.23.5 (#229) (@dependabot[bot],
@npm-cli-bot)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] config var "node-gyp" not respected in npm 7
3 participants