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-canvas: Error C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 #3068

Closed
Corristo-X opened this issue Sep 8, 2024 · 13 comments
Labels
node-canvas https://github.com/Automattic/node-canvas Windows

Comments

@Corristo-X
Copy link

Corristo-X commented Sep 8, 2024

Error: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1
at ChildProcess.onExit (D:\RoboOptim\RoboOptim\node_modules@electron\rebuild\node_modules\node-gyp\lib\build.js:203:23)
at ChildProcess.emit (node:events:517:28)
at ChildProcess._handle.onexit (node:internal/child_process:292:12)

✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild 'D:\RoboOptim\RoboOptim\node_modules\canvas'

Error: node-gyp failed to rebuild 'D:\RoboOptim\RoboOptim\node_modules\canvas'
at ChildProcess. (D:\RoboOptim\RoboOptim\node_modules@electron\rebuild\lib\module-type\node-gyp\node-gyp.js:118:24)
at ChildProcess.emit (node:events:517:28)
at ChildProcess._handle.onexit (node:internal/child_process:292:12)

node-gyp v10.2.0
node v17.9.1/ same error on node v20.17.0
windows 11
on linux mint the program works fine for me.

@Corristo-X Corristo-X changed the title Erro C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 Error C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 Sep 8, 2024
@cclauss cclauss added the Windows label Sep 8, 2024
@cclauss
Copy link
Contributor

cclauss commented Sep 8, 2024

You might want to look at the Windows steps at https://github.com/Automattic/node-canvas/blob/master/.github/workflows/ci.yaml#L31

Please do not post screenshot images because they are not searchable.

@Corristo-X
Copy link
Author

Corristo-X commented Sep 8, 2024

@cclauss unfortunately nothing helped from this link

@turbidwater
Copy link

I am in the same boat. I have tried downgrading both node and node-gyp to the versions indicated in the link and still am running into the error. Mine is while trying to build libdvbtee_parser. I'm using Python 3.13.0, Visual Studio 2022 with the C for Desktop workload, and node 18.12.0 and node-gyp 8 installed globally.

@cclauss
Copy link
Contributor

cclauss commented Oct 31, 2024

Python 3.12 and 3.13 will break node-gyp < v10 because the need setuptools. See what!s new in Python 3.12 for details.

@turbidwater
Copy link

Thanks for the quick response! I downgraded python to 3.11 and am still encountering the same issues:

npm ERR! gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64',
npm ERR! gyp info spawn args   '/m:8'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\nthin\AppData\Roaming\nvm\v18.12.0\node_modules\npm\node_modules\node-gyp\lib\build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.26100
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\nthin\\AppData\\Roaming\\nvm\\v18.12.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "-j" "8"
npm ERR! gyp ERR! cwd C:\_projects\THEO\THEOplayer\src\theoplayer-next\web\streams\node_modules\libdvbtee_parser
npm ERR! gyp ERR! node -v v18.12.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nthin\AppData\Local\npm-cache\_logs\2024-10-31T18_44_30_337Z-debug-0.log

I notice that the node-gyp version is listed in the output as 9.1.0, yet I've only installed 8.4.1, and that's the version in my nodejs install.

@cclauss
Copy link
Contributor

cclauss commented Oct 31, 2024

https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md#updating-the-npm-bundled-version-of-node-gyp

npm bundles its own, internal, copy of node-gyp.

Also, look at package.json and package-lock.json files in the local directories.

@turbidwater
Copy link

Thanks for the suggestion. Following that I was able to get it to use v8.4.1. That then asked for a Windows SDK for Visual Studio, which I installed and now I am back at the same place:

npm ERR! gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64',
npm ERR! gyp info spawn args   '/m:8'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\nthin\AppData\Roaming\nvm\v18.12.0\node_modules\npm\node_modules\@npmcli\run-script\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.26100
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\nthin\\AppData\\Roaming\\nvm\\v18.12.0\\node_modules\\npm\\node_modules\\@npmcli\\run-script\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "-j" "8"
npm ERR! gyp ERR! cwd C:\_projects\web\streams\node_modules\libdvbtee_parser
npm ERR! gyp ERR! node -v v18.12.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok

Any other suggestions?

@gongyuan300
Copy link

Python 3.12 和 3.13 将破坏 node-gyp < v10,因为需要setuptools。有关详细信息,请参阅 Python 3.12 中的新增功能。

这个是啥意思,是说安装python3.12以上版本后,环境会被破坏吗导致打包失败

@cclauss
Copy link
Contributor

cclauss commented Dec 6, 2024

@NenadBojkovski
Copy link

Hi!
I'm having the same issue. @turbidwater did you manage to find a fix/workaround for it?

Here is my setup:
node v.23.4.0
npm v10.9.2
node-gyp v11.0.0
python 3.12.6
VS 2022 BuildTools
OS Windows_NT 10.0.19845

Thank you!

@cclauss cclauss added the node-canvas https://github.com/Automattic/node-canvas label Dec 16, 2024
@cclauss cclauss changed the title Error C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 node-canvas: Error C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 Dec 16, 2024
@turbidwater
Copy link

@NenadBojkovski No, I never found a solution. I just removed the package that was requiring node-gyp, since it was not an essential package for me.

@NenadBojkovski
Copy link

OK, after some days spent on this issue I think I found out where this issue is coming from...
The issue is that in the binding.gyp of the packages I tested with @node-rt-win10-rs4/windows.services.store and @node-rt-win10-rs4/windows.devices.geolocation there is /ZW compiler option being configured which is not compatible with -std:c++20 standard. When I tried setting the older standard e.g. -std:c++14, then the Error C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 was fixed but my node-gyp was complaining about nodejs needing -std:c++20 standard, so it was kind of a deadlock.

Then I downgraded everything:
node v.16.0.2
npm v8.19.4
node-gyp v9.0.0
python 3.8.10
VS 2019 BuildTools

then I was able to compile the modules.

@cclauss
Copy link
Contributor

cclauss commented Dec 20, 2024

@cclauss cclauss closed this as completed Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-canvas https://github.com/Automattic/node-canvas Windows
Projects
None yet
Development

No branches or pull requests

5 participants