Closed soroushm closed 1 month ago
can confirm same issue, a temp fix is to include the latest node-gyp
as a devDependency in YOUR package.json
npm install node-gyp --save-dev
should install 10.0.1
Hi, I'm struggling to get electron-rebuild to work due to node-gyp version and Python version (as others reported above).
I've tried the so-called temp fix by adding the devDependency in my package.json to the latest node-gyp but it's not getting used by electron-rebuild.
Is there any other known workaround for this issue?
As references in https://github.com/nodejs/node-gyp/issues/2869#issuecomment-1966234393, node-gyp v10+ solves this error; distutils was removed from python 3.12 as mentioned here, which causes this error.
A way to fix this is to add an overrides to your package.json
.
In my case (using pnpm) on the highest level in my package.json
:
"pnpm": {
"overrides": {
"node-gyp": "^10.0.0"
}
},
Do this according to how your package manager handles overrides.
If your package manager does not update correctly, check your lock file and confirm @electron/rebuild
has the depency node-gyp
set to some 10+ version, at the time of writing 10.0.1
. If this is the case, try deleting your lockfile and have it re-generate with e.g. pnpm i
or equivalent in your package manager.
EDIT:
I have been fiddling around with this a while before I came to this conclusion which is not enough to get it running, so the above will not work.
I have edited the file node_modules\@electron\rebuild\lib\module-type\node-gyp\worker.js:29
to remove the promisify since v10 of node-gyp changes it's internals to return promises natively.
That is an integral part of the solution. I guess I'll see if I can cook up a PR to this project to resolve this issue.
overrides
didn't work for me, but this did:
pip install setuptools
or possibly
python3 -m pip install --break-system-packages setuptools
can confirm same issue, a temp fix is to include the latest
node-gyp
as a devDependency in YOUR package.jsonnpm install node-gyp --save-dev
should install 10.0.1
thx for temp fix actually
pip install setuptools
Thanks, this solutions worked for me on windows
overrides
didn't work for me, but this did:pip install setuptools
or possibly
python3 -m pip install --break-system-packages setuptools
This works for me. Thanks @verhovsky
What's the status on this? It looks like #1128 and #1152 are both proposed fixes.
:tada: This issue has been resolved in version 3.7.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
distutils has been removed in Python v3.12. we need to upgrade version of node-gyp (to v10+)