desktop / registry-js

A simple and opinionated library for working with the Windows registry
MIT License
153 stars 47 forks source link

Node-Gyp failure while packing registry.js on Electron App #224

Open lamathe opened 3 years ago

lamathe commented 3 years ago

c:\users\lamathe\appdata\local\temp\electron-packager\win32-x64\chime-win32-x64\resources\app\node_modules\registry-js\node_modules\node-addon-api\napi-inl.h(1393): error C3861: 'napi_object_freeze': identifier not found [C:\Users\lamathe\AppData\Local\Temp\electron-packager\win32-x64\Chime-win32-x64\resources\app\node_modules\registry-js\build\registry.vcxproj] c:\users\lamathe\appdata\local\temp\electron-packager\win32-x64\chime-win32-x64\resources\app\node_modules\registry-js\node_modules\node-addon-api\napi-inl.h(1399): error C3861: 'napi_object_seal': identifier not found [C:\Users\lamathe\AppData\Local\Temp\electron-packager\win32-x64\Chime-win32-x64\resources\app\node_modules\registry-js\build\registry.vcxproj]

An unhandled error has occurred inside Forge: node-gyp failed to rebuild 'C:\Users\lamathe\AppData\Local\Temp\electron-packager\win32-x64\Chime-win32-x64\resources\app\node_modules\registry-js'. Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1

Error: node-gyp failed to rebuild 'C:\Users\lamathe\AppData\Local\Temp\electron-packager\win32-x64\Chime-win32-x64\resources\app\node_modules\registry-js'. Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1

at ModuleRebuilder.rebuildNodeGypModule (C:\Users\lamathe\Documents\GitHub\ChimeElectron\src\ChimeElectron\node_modules\electron-rebuild\src\module-rebuilder.ts:231:13)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at Rebuilder.rebuildModuleAt (C:\Users\lamathe\Documents\GitHub\ChimeElectron\src\ChimeElectron\node_modules\electron-rebuild\src\rebuild.ts:283:5)
at Rebuilder.rebuild (C:\Users\lamathe\Documents\GitHub\ChimeElectron\src\ChimeElectron\node_modules\electron-rebuild\src\rebuild.ts:189:9)
at C:\Users\lamathe\Documents\GitHub\ChimeElectron\src\ChimeElectron\node_modules\@electron-forge\core\src\util\rebuild.ts:33:5

Error while packaging the electron app

mkermani144 commented 3 years ago

Same happens with electron-builder.

sergiou87 commented 3 years ago

I think the problem with electron-builder is already solved in electron-builder and you only need to upgrade that package, see https://github.com/atom/node-keytar/issues/380#issuecomment-860445051

Maybe the issue with node-gyp is the same?

registry-js is used by GitHub Desktop and it builds without problems 🤔

mkermani144 commented 3 years ago

I don't know if it's a electron-builder, node-gyp or repo issue, but it still exists in the latest version of electron-builder (22.11.7 at this time).

alamathe1 commented 3 years ago

We use electron-forge and still experience it.

alamathe1 commented 3 years ago

Quick update, it works on the following:

node -v
v14.16.0
npm -v
6.14.11

The above uses NAPI_VERSION=7 but latest node where is is broken on uses 8.

Failure is at https://nodejs.org/api/n-api.html; https://github.com/nodejs/node-addon-api/blob/main/napi-inl.h#L1391-L1403

mkermani144 commented 3 years ago

It seems a npm bug. I used yarn to install deps and it all works fine.