Open debianw opened 1 year ago
I was having the same issue. It's in the nan package. There's a patch fix in this issue: https://github.com/nodejs/nan/issues/942
Whilst the patch is waiting to be merged you can apply it manually to your local copy in node_modules
Whilst the patch is waiting to be merged you can apply it manually to your local copy in node_modules
✅ can confirm that manually applying this patch will solve the problem
I created a fork of node printer https://github.com/thealexbaron/node-printer and updated the dependencies to use this commit https://github.com/weedz/nan/commit/a679b69b92e1997f6b40f1d3981a58a0021e1b99 and I was able to get node-printer
to install with electron-builder 20
I'm trying to use the fork @thealexbaron so graciously provided to address this, but having what looks like a different issue. Hoping someone can tell me where I'm going wrong? I try to install this simple package.json:
{
"name": "bug",
"version": "0.0.1",
"scripts": {
"preinstall": "npm config set msvs_version=2015",
"postinstall": "electron-rebuild -f -m node_modules/@thealexbaron/node-printer"
},
"keywords": [],
"dependencies": {
"@thealexbaron/node-printer": "https://github.com/thealexbaron/node-printer.git",
"nan": "git+https://github.com/weedz/nan.git"
},
"devDependencies": {
"electron": "20.0.2",
"electron-rebuild": "3.2.7",
"node-abi": "3.24.0"
}
}
But I receive these errors:
C:\views\electron-rebuild-issue\electron-20>npm install
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> bug@0.0.1 preinstall
> npm config set msvs_version=2015
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> bug@0.0.1 postinstall
> electron-rebuild -f -m node_modules/@thealexbaron/node-printer
\ Building module: node-printer, Completed: 0Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
\ Building module: node-printer, Completed: 0cl : Command line warning D9002: ignoring unknown option '/Zc:__cplusplus' [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
node_printer.cc
| Building module: node-printer, Completed: 0c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-callbacks.h(221): error C2059: syntax error: '' [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-callbacks.h(335): error C2059: syntax error: '' [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-isolate.h(292): error C3646: 'legacy_oom_error_callback': unknown override specifier [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-isolate.h(292): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-isolate.h(1482): error C2061: syntax error: identifier 'LegacyOOMErrorCallback' [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-isolate.h(1545): error C2061: syntax error: identifier 'WasmDynamicTieringEnabledCallback' [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-initialization.h(290): error C2061: syntax error: identifier 'LegacyOOMErrorCallback' [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
c:\users\gmerrill\.electron-gyp\20.0.2\include\node\v8-typed-array.h(28): warning C4309: 'static_cast': truncation of constant value [C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer\build\node_printer.vcxproj]
× Rebuild Failed
An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild 'C:\views\electron-rebuild-issue\electron-20\node_modules\@thealexbaron\node-printer'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".
Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
The errors look different from what others reported, so I wonder if I have some more fundamental issue. Does anyone have a pointer for what I'm doing wrong? Is my MSBuild/msvs_version version too old?
Also note, it works fine for electron 19 ... it only fails when I switch to 20.
Disregard my last comment - I installed VS 2022 with C++ and the following build fine for me. So looks like everything is good.
{
"name": "bug",
"version": "0.0.1",
"scripts": {
"postinstall": "electron-rebuild -f -m node_modules/@thealexbaron/node-printer"
},
"keywords": [],
"dependencies": {
"@thealexbaron/node-printer": "https://github.com/thealexbaron/node-printer.git",
"nan": "git+https://github.com/weedz/nan.git"
},
"devDependencies": {
"electron": "20.0.1",
"electron-rebuild": "3.2.7",
"node-abi": "3.24.0"
}
}
FYI I was also able to build successfully with 21.0.1
{
"name": "bug",
"version": "0.0.1",
"scripts": {
"postinstall": "electron-rebuild -f -m node_modules/@thealexbaron/node-printer"
},
"keywords": [],
"dependencies": {
"@thealexbaron/node-printer": "https://github.com/thealexbaron/node-printer.git",
"nan": "git+https://github.com/weedz/nan.git"
},
"devDependencies": {
"electron": "21.0.1",
"electron-rebuild": "3.2.7",
"node-abi": "3.24.0"
}
}
@greghmerrill can you please share comple code with electron 20, I'm facing error with electron 20
To make it work with Electron 20, use the patched version by https://github.com/grandchef/node-printer and change bindings.gyp to use -std=c++17
under xcode_settings
. No change was required for windows it seems.
In my case it seems to yield positive results, although it's too early to say.
Also use Python up to v3.9, later versions wreck node-gyp. You can override it with the PYTHON
env variable.
Node: 16.16.0 (lts) OS: MacOS 12.5 @thiagoelg/node-printer: 0.6.2 electron v20.0.3
Electron v19 is OK, but Electron v20 is complaining with this: