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

How upgrade node-gyp with npm 10? #2942

Closed
Apollon77 opened this issue Nov 6, 2023 · 8 comments
Closed

How upgrade node-gyp with npm 10? #2942

Apollon77 opened this issue Nov 6, 2023 · 8 comments

Comments

@Apollon77
Copy link

Apollon77 commented Nov 6, 2023

Because of #2869 and the fact that Github upgraded Python to 3.12 in their newest macos runner image (see actions/runner#2972) I currently try to get node-gyp upgraded somehow.

In fact the instructions on https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md have no effect with npm 10 as it seems. I also tried several other options I found in the web but all are failingor do not use the new node-gyp.

What is the current way to do it?

The only way I found working BTW is to add node-gyp in the respective version as dependency to the module in question. Then Npm is using his version over the bundled one. maybe this should be the default solution (ok honestly ... maybe not "the best" solution but a working one?

@dlqqq
Copy link

dlqqq commented Nov 12, 2023

@Apollon77 I've opened a related issue to explicitly indicate supported Node versions per node-gyp release: #2948

@cclauss
Copy link
Contributor

cclauss commented Nov 13, 2023

Python v3.12 requires node-gyp release >= v10.

@JakeWilsonSalesforce
Copy link

Python v3.12 requires node-gyp release >= v10.

Yes so how do you force npm to globally use node-gyp v10? The instructions here: https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md don't work for npm v10. npm is still trying to use node-gyp v7.x.

@cclauss
Copy link
Contributor

cclauss commented Feb 1, 2024

Can you please provide the commands typed and the output when you tried those instructions on npm v10?

Or just python3 -m pip install --upgrade node-gyp

@oasaleh
Copy link

oasaleh commented Feb 13, 2024

@cclauss I used the command you pasted but getting this error. I've been trying all day to get NPM to use a different version of node-gyp.

python3 -m pip install --upgrade node-gyp
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement node-gyp (from versions: none)
ERROR: No matching distribution found for node-gyp

@cclauss
Copy link
Contributor

cclauss commented Feb 13, 2024

First create and activate a venv.

@LeventCelik
Copy link

The only way I found working BTW is to add node-gyp in the respective version as dependency to the module in question. Then Npm is using his version over the bundled one. maybe this should be the default solution (ok honestly ... maybe not "the best" solution but a working one?

Thank you! This is unrelated to Python, but I have been trying for two days straight to get a project to use the latest node-gyp on Windows, followed the instructions on the documentation, but node still kept using an older version (v6.1.0). This got it working.

@Tuscan-blue
Copy link

Tuscan-blue commented May 11, 2024

Before

Windows11, Python3.12, Nodejs v21.7.0, npm v10.5.0, node-gyp v10.1.0
Facing the same problem....

I have successfully updated "node-gyp" at the path "C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\run-script" using npm i node-gyp@latest. However, after running npm install in the project, it still shows "the npm error gyp info using node-gyp@8.4.1".


Update

After the aforementioned steps, I recreated the project, deleted the package-lock.json, ran npm -i -g node-gyp@latest, and then npm install. It worked perfectly.

@cclauss cclauss closed this as completed May 11, 2024
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

No branches or pull requests

7 participants