-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Error while running electron-builder install-app-deps
with @electron/[email protected]
with Two package.json Structure #9143
Description
electron-builder
version: 26.0.12 (though it does not seem to be exclusive to this version)electron
version: 35.0.2 (though it does not seem to be exclusive to this version)@electron/rebuild
: 4.0.1 (though I think 4.0.0 also has the problem. It seems 3.7.2 does not have this problem)- Platform: Windows
Hello electron-builder
maintainers!
When I run npx electron-builder install-app-deps
with @electron/[email protected]
, I am encountering an error in which @electron/rebuild
seems to be unable to determine the Electron version. Also, in some cases (I can't find particular rhyme or reason as to when or why it flips between these two errors), node-gyp
seems to be unable to find a Visual Studio installation. I am using the Two package.json Structure. I can reproduce this issue easily using Electron React Boilerplate with some slight modifications.
This issue does not occur if I run @electron/rebuild
directly with electron-rebuild --parallel --types prod,dev,optional --module-dir release/app
.
To reproduce:
Either run these manual steps to reproduce on your own (which gives me the "Cannot find Electron" error below):
git clone https://github.com/electron-react-boilerplate/electron-react-boilerplate
(as of when I am testing this,main
is on commit0c83f5faa4ba503bdfa6f75e3bc273560f938ccd
)cd electron-react-boilerplate
npm i
npm i -D @electron/[email protected] electron-builder@latest
(Installingelectron-builder
latest because I was sometimes getting errors thatnode-abi
didn't know about the Electron version)cd release/app
npm i sqlite3
cd ../..
npx electron-builder install-app-deps
(Produces "Cannot find Electron" error below)npm i -D @electron/[email protected]
(the version it was on before changing it)npx electron-builder install-app-deps
Or clone my repo and reproduce:
git clone https://github.com/tjcouch-sil/electron-react-boilerplate.git
git checkout tjc/rebuild-issue-4.0.1
npm i
.
The state of the repo on my branch is essentially equivalent to running steps 1-6 from the manual process above. I would expect it to hit the Cannot find Electron error when running npm i
(which runs electron-builder install-app-deps
in the postinstall
), but it doesn't; it hits another error "Cannot find Visual Studio".
**Error Log: Cannot find Electron**
PS C:\Users\tj_co\source\repos\electron-react-boilerplate> npx electron-builder install-app-deps
• electron-builder version=25.1.8
• loaded configuration file=package.json ("build" field)
• installing production dependencies platform=win32 arch=x64 appDir=C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app
⨯ C:\Users\tj_co\AppData\Local\Volta\tools\image\node\22.14.0\node.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Output:
> [email protected] postinstall
> npm run rebuild && npm run link-modules
> [email protected] rebuild
> node -r ts-node/register ../../.erb/scripts/electron-rebuild.js
Error output:
npm warn config production Use `--omit=dev` instead.
An unhandled error occurred inside electron-rebuild
Unable to find electron's version number, either install it or specify an explicit version
Error: Unable to find electron's version number, either install it or specify an explicit version
at file:///C:/Users/tj_co/source/repos/electron-react-boilerplate/node_modules/@electron/rebuild/lib/cli.js:65:19
Error: Command failed: ..\..\node_modules\.bin\electron-rebuild --force --types prod,dev,optional --module-dir .
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at checkExecSyncError (node:child_process:882:11)
at execSync (node:child_process:954:15)
at Object.<anonymous> (C:\Users\tj_co\source\repos\electron-react-boilerplate\.erb\scripts\electron-rebuild.js:16:11)
at Module._compile (node:internal/modules/cjs/loader:1554:14)
at Module.m._compile (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\ts-node\src\index.ts:1618:23)
at node:internal/modules/cjs/loader:1706:10
at Object.require.extensions.<computed> [as .js] (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1289:32) {
status: 4294967295,
signal: null,
output: [ null, null, null ],
pid: 9472,
stdout: null,
stderr: null
}
npm error code 1
npm error path C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c npm run rebuild && npm run link-modules
npm error A complete log of this run can be found in: C:\Users\tj_co\AppData\Local\npm-cache\_logs\2025-06-04T22_11_04_774Z-debug-0.log
failedTask=installAppDeps stackTrace=Error: C:\Users\tj_co\AppData\Local\Volta\tools\image\node\22.14.0\node.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Output:
> [email protected] postinstall
> npm run rebuild && npm run link-modules
> [email protected] rebuild
> node -r ts-node/register ../../.erb/scripts/electron-rebuild.js
Error output:
npm warn config production Use `--omit=dev` instead.
An unhandled error occurred inside electron-rebuild
Unable to find electron's version number, either install it or specify an explicit version
Error: Unable to find electron's version number, either install it or specify an explicit version
at file:///C:/Users/tj_co/source/repos/electron-react-boilerplate/node_modules/@electron/rebuild/lib/cli.js:65:19
Error: Command failed: ..\..\node_modules\.bin\electron-rebuild --force --types prod,dev,optional --module-dir .
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at checkExecSyncError (node:child_process:882:11)
at execSync (node:child_process:954:15)
at Object.<anonymous> (C:\Users\tj_co\source\repos\electron-react-boilerplate\.erb\scripts\electron-rebuild.js:16:11)
at Module._compile (node:internal/modules/cjs/loader:1554:14)
at Module.m._compile (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\ts-node\src\index.ts:1618:23)
at node:internal/modules/cjs/loader:1706:10
at Object.require.extensions.<computed> [as .js] (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1289:32) {
status: 4294967295,
signal: null,
output: [ null, null, null ],
pid: 9472,
stdout: null,
stderr: null
}
npm error code 1
npm error path C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c npm run rebuild && npm run link-modules
npm error A complete log of this run can be found in: C:\Users\tj_co\AppData\Local\npm-cache\_logs\2025-06-04T22_11_04_774Z-debug-0.log
at ChildProcess.<anonymous> (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\builder-util\src\util.ts:255:14)
at Object.onceWrapper (node:events:633:26)
at ChildProcess.emit (node:events:518:28)
at ChildProcess.cp.emit (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1101:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
**Error Log: Cannot find Visual Studio**
PS C:\Users\tj_co\source\repos\electron-react-boilerplate> npx electron-builder install-app-deps
• electron-builder version=26.0.12
• loaded configuration file=package.json ("build" field)
• installing production dependencies pm=npm platform=win32 arch=x64 projectDir=C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app appDir=C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app
⨯ npm.cmd process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Error output:
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn cleanup Failed to remove some directories [
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\socks',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\socks\docs'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\socks\\docs'
npm warn cleanup }
npm warn cleanup ],
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\tar-fs\test\fixtures\d'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\tar-fs\\test\\fixtures\\d'
npm warn cleanup }
npm warn cleanup ],
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\@npmcli',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\@npmcli'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\@npmcli'
npm warn cleanup }
npm warn cleanup ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\sqlite3
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install -r napi || node-gyp rebuild
npm error prebuild-install warn This package does not support N-API version 35.0.2
npm error prebuild-install warn install No prebuilt binaries found (target=35.0.2 runtime=napi arch=x64 libc= platform=win32)
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | win32 | x64
npm error (node:23720) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error gyp info find Python using Python version 3.6.8 found at "C:\Python36\python.exe"
npm error gyp ERR! find VS
npm error gyp ERR! find VS msvs_version not set from command line or npm config
npm error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm error gyp ERR! find VS checking VS2022 (17.14.36109.1) found at:
npm error gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Professional"
npm error gyp ERR! find VS - found "Visual Studio C++ core features"
npm error gyp ERR! find VS - found VC++ toolset: v143
npm error gyp ERR! find VS - missing any Windows SDK
npm error gyp ERR! find VS checking VS2017 (15.9.33423.255) found at:
npm error gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
npm error gyp ERR! find VS - found "Visual Studio C++ core features"
npm error gyp ERR! find VS - missing any VC++ toolset
npm error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm error gyp ERR! find VS looking for Visual Studio 2015
npm error gyp ERR! find VS - not found
npm error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm error gyp ERR! find VS
npm error gyp ERR! find VS **************************************************************
npm error gyp ERR! find VS You need to install the latest version of Visual Studio
npm error gyp ERR! find VS including the "Desktop development with C++" workload.
npm error gyp ERR! find VS For more information consult the documentation at:
npm error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm error gyp ERR! find VS **************************************************************
npm error gyp ERR! find VS
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm error gyp ERR! stack at VisualStudioFinder.fail (C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm error gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\util.js:54:7
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\util.js:33:16
npm error gyp ERR! stack at ChildProcess.exithandler (node:child_process:421:5)
npm error gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm error gyp ERR! stack at maybeClose (node:internal/child_process:1101:16)
npm error gyp ERR! System Windows_NT 10.0.26100
npm error gyp ERR! command "C:\\Users\\tj_co\\AppData\\Local\\Volta\\tools\\image\\node\\22.14.0\\node.exe" "C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\sqlite3
npm error gyp ERR! node -v v22.14.0
npm error gyp ERR! node-gyp -v v8.4.1
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: C:\Users\tj_co\AppData\Local\npm-cache\_logs\2025-06-04T22_43_32_899Z-debug-0.log
failedTask=installAppDeps stackTrace=Error: npm.cmd process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Error output:
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn cleanup Failed to remove some directories [
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\socks',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\socks\docs'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\socks\\docs'
npm warn cleanup }
npm warn cleanup ],
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\tar-fs\test\fixtures\d'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\tar-fs\\test\\fixtures\\d'
npm warn cleanup }
npm warn cleanup ],
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\@npmcli',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\@npmcli'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\@npmcli'
npm warn cleanup }
npm warn cleanup ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\sqlite3
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install -r napi || node-gyp rebuild
npm error prebuild-install warn This package does not support N-API version 35.0.2
npm error prebuild-install warn install No prebuilt binaries found (target=35.0.2 runtime=napi arch=x64 libc= platform=win32)
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | win32 | x64
npm error (node:23720) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error gyp info find Python using Python version 3.6.8 found at "C:\Python36\python.exe"
npm error gyp ERR! find VS
npm error gyp ERR! find VS msvs_version not set from command line or npm config
npm error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm error gyp ERR! find VS checking VS2022 (17.14.36109.1) found at:
npm error gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Professional"
npm error gyp ERR! find VS - found "Visual Studio C++ core features"
npm error gyp ERR! find VS - found VC++ toolset: v143
npm error gyp ERR! find VS - missing any Windows SDK
npm error gyp ERR! find VS checking VS2017 (15.9.33423.255) found at:
npm error gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
npm error gyp ERR! find VS - found "Visual Studio C++ core features"
npm error gyp ERR! find VS - missing any VC++ toolset
npm error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm error gyp ERR! find VS looking for Visual Studio 2015
npm error gyp ERR! find VS - not found
npm error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm error gyp ERR! find VS
npm error gyp ERR! find VS **************************************************************
npm error gyp ERR! find VS You need to install the latest version of Visual Studio
npm error gyp ERR! find VS including the "Desktop development with C++" workload.
npm error gyp ERR! find VS For more information consult the documentation at:
npm error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm error gyp ERR! find VS **************************************************************
npm error gyp ERR! find VS
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm error gyp ERR! stack at VisualStudioFinder.fail (C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm error gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\util.js:54:7
npm error gyp ERR! stack at C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\node-gyp\lib\util.js:33:16
npm error gyp ERR! stack at ChildProcess.exithandler (node:child_process:421:5)
npm error gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm error gyp ERR! stack at maybeClose (node:internal/child_process:1101:16)
npm error gyp ERR! System Windows_NT 10.0.26100
npm error gyp ERR! command "C:\\Users\\tj_co\\AppData\\Local\\Volta\\tools\\image\\node\\22.14.0\\node.exe" "C:\\Users\\tj_co\\source\\repos\\electron-react-boilerplate\\release\\app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd C:\Users\tj_co\source\repos\electron-react-boilerplate\release\app\node_modules\sqlite3
npm error gyp ERR! node -v v22.14.0
npm error gyp ERR! node-gyp -v v8.4.1
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: C:\Users\tj_co\AppData\Local\npm-cache\_logs\2025-06-04T22_43_32_899Z-debug-0.log
at ChildProcess.<anonymous> (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\builder-util\src\util.ts:259:14)
at Object.onceWrapper (node:events:633:26)
at ChildProcess.emit (node:events:518:28)
at ChildProcess.cp.emit (C:\Users\tj_co\source\repos\electron-react-boilerplate\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1101:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
Any ideas what's going on with all of this?
Thanks for making this great package. It is very helpful! Let me know if there is anything else I can do to help.