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

node-gyp version issue #2354

Closed
RichardFoss opened this issue Mar 26, 2021 · 6 comments
Closed

node-gyp version issue #2354

RichardFoss opened this issue Mar 26, 2021 · 6 comments
Labels

Comments

@RichardFoss
Copy link

Thanks for this opportunity to report an issue!
I have been using node-gyp on Mac and Windows, and am currently experiencing a problem in Windows. I have:

  1. Installed VS community 2017
  2. Installed VS Build tools 2017
  3. Installed NVM
  4. Ran nvm install 12.12.0 then nvm use 12.12.0
  5. Did a npm install –global windows-build-tools from administrator Powershell
  6. Did an npm config set msvs_version 2017
  7. Did an npm install –g node-gyp
  8. Did an npm install –g nw-gyp
    When I do an npm node-gyp -v , I get the version as 6.11.3
    On doing an npm install in VSCode, I get the following within the terminal output:

gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\r.foss\AppData\Roaming\nvm\v12.12.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Git-Repos\ImmerGo-Demo\immergo-demo\node_modules\midi
gyp ERR! node -v v12.12.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! This is a bug in node-gyp.

I can't understand why the error is occurring, and also why the node-gyp version is indicated as 5.0.3 ?
Any help would be much appreciated, thanks!

@cclauss cclauss added the ERR! node-gyp -v < v10.x.x npm install -g npm label Mar 27, 2021
@cclauss
Copy link
Contributor

cclauss commented Mar 27, 2021

@RichardFoss
Copy link
Author

Thank you very much for the link! Unfortunately I have the same error. This is what I did:

  1. Removed nodejs folder from C:\Program Files, removed nvm folder from C:\Users\r.foss

  2. Installed NVM via nvm-setup.exe

  3. From administrator:cmd ran nvm install 12.12.0, then nvm use 12.12.0

  4. From administrator:cmd did a where node - got back C:\Program Files\nodejs\node.exe

  5. From administrator:cmd did a cd "C:\Program Files\nodejs\node_modules\npm"

  6. From administrator:cmd did npm install -g node-gyp@latest

  7. From administrator:cmd did npm install -global windows-build-tools

  8. From administrator:cmd did npm config set msvs_version 2017

  9. From administrator:cmd did npm install -g nw-gyp

  10. I checked versions with:

C:\Users\r.foss>node -v
v12.12.0

C:\Users\r.foss>where node
C:\Program Files\nodejs\node.exe

C:\Users\r.foss>node-gyp -v
v7.1.2

C:\Users\r.foss>npm node-gyp -v
6.11.3

  1. After that, I went to my VSCode project and did npm install. The display is listed below:

So the same apparent node-gyp bug with the odd version number being discovered.

Thanks again for looking at this issue, much appreciated!


PS D:\Git-Repos\ImmerGo-Demo\immergo-demo> npm install

midi@1.0.0 install D:\Git-Repos\ImmerGo-Demo\immergo-demo\node_modules\midi
node-gyp rebuild

D:\Git-Repos\ImmerGo-Demo\immergo-demo\node_modules\midi>if not defined npm_config_node_gyp (node "C:\Users\r.foss\AppData\Roaming\nvm\v12.12.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\r.foss\AppData\Roaming\nvm\v12.12.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn = ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:456:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\r.foss\AppData\Roaming\nvm\v12.12.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Git-Repos\ImmerGo-Demo\immergo-demo\node_modules\midi
gyp ERR! node -v v12.12.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! This is a bug in node-gyp.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! https://github.com/nodejs/node-gyp/issues
npm WARN immergodemo@1.9.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-linux@1.3.1 (node_modules\7zip-bin-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-linux@1.3.1: wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-mac@1.0.1 (node_modules\7zip-bin-mac):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-mac@1.0.1: wanted {"os":"darwin","arch":"any"}
(current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! midi@1.0.0 install: node-gyp rebuild
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the midi@1.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\r.foss\AppData\Roaming\npm-cache_logs\2021-03-27T11_12_05_319Z-debug.log
PS D:\Git-Repos\ImmerGo-Demo\immergo-demo>

@DeeDeeG
Copy link
Contributor

DeeDeeG commented Mar 30, 2021

Hmm, the instructions in the Wiki for Windows are a bit wrong. Those instructions use the -g flag when they shouldn't.

To update npm's copy of node-gyp, one should:

  • Go to [Your_node_dir]\node_modules\npm and
  • run npm install node-gyp
    • (This isn't right: npm install -g node-gyp)

Also: npm-lifecycle has its own dependency on node-gyp that should be updated too:

  • Go to [Your_node_dir]\node_modules\npm\node_modules\npm-lifecycle and
  • run npm install node-gyp.

That is the version that actually gets run when doing an npm install, apparently.

(I suspect npm's top-level dependency on node-gyp is just there to allow more direct and convenient control over the version of node-gyp that gets shipped with npm, for the npm maintainers. It seems a bit redundant, otherwise.)

@RichardFoss
Copy link
Author

Thanks again for comments. After doing a:
npm install --verbose
I found the following:
gyp verb using MSBuild: =
So seemingly no path to MSBuild, even though previously there was the following:
gyp info find VS using VS2017 (15.9.28307.1440) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
I did the following:
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
and now am able to successfully rebuild native modules.

@cclauss
Copy link
Contributor

cclauss commented Mar 31, 2021

Can this issue be closed?

@RichardFoss
Copy link
Author

Apologies for the slow reply - from my side, yes, it can be closed.
Thanks for your help!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants