electron-builder: The path of node js is not correctly recognized on Windows
- Electron-Builder Version: 22.11.7
- Node Version: 14.17.3
- Electron Version: 13.1.6
- Electron Type (current, beta, nightly): current
- Target: N/A
While running installing-app-deps or any other commands, following error occurs:
• electron-builder version=22.11.7
• loaded configuration file=package.json ("build" field)
• installing production dependencies platform=win32 arch=x64 appDir=D:\dev\cryptoElectron\src
• spawning command=C:\Users\Losse\AppData\Local\Temp\xfs-8e15e263\node yarn install --production cwd=D:\dev\cryptoElectron\src
• exited command=node code=-4058 pid=undefined
⨯ spawn C:\Users\Losse\AppData\Local\Temp\xfs-8e15e263\node ENOENT failedTask=installAppDeps stackTrace=Error: spawn C:\Users\Losse\AppData\Local\Temp\xfs-8e15e263\node ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
This may relate to the spawn method, the closest code I found is:
https://github.com/electron-userland/electron-builder/blob/5b4305ec336cf6f5866a26cde7fe99f18d7ac566/packages/app-builder-lib/src/util/yarn.ts#L108
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (12 by maintainers)
Commits related to this issue
- fix: using regex to determine yarn version to account for newer releases of yarn (i.e. yarn 3). fixes: #6069 — committed to mmaietta/electron-builder by mmaietta 3 years ago
- fix: using regex to determine yarn version to account for newer releases of yarn (i.e. yarn 3). fixes: #6069 (#6071) — committed to electron-userland/electron-builder by mmaietta 3 years ago
- fix: Yarn is not found on Windows machine Related to #6069 — committed to Losses/electron-builder by Losses 3 years ago
- fix(windows): detect node path correctly on windows with cross-spawn (#6069) (#6172) — committed to electron-userland/electron-builder by Losses 3 years ago
@mmaietta Wow, thanks!
@mmaietta since
process.env.npm_execpathalready have a value,process.env.NPM_CLI_JSwon’t be used.I’m really headache about how to handle this, adding another env variable like
USE_YARN_COMMANDwhich will triggerwhichmay be a solution? How can we name this variable is another problem…