`npmRebuild: false` will skip dependency installation altogether
From what I understand, setting npmRebuild to false should (and so it has in the past) skip the rebuild of dependencies, but not their installation.
We've been using this to avoid the rebuild of dependencies. They've still been installed.
This should be the cause: https://github.com/electron-userland/electron-builder/blob/841a290554aca3a2142bbb6a15ac3e58f4c3ce16/packages/app-builder-lib/src/packager.ts#L591
It would be nice if you could look into this. Thanks in advance!
and so it has in the past
What version was this operating for in the past? Looking to determine if a git bisect/diff could help here in identifying anything amiss
@mmaietta We used 25.1.8 before.
I didn't analyze it in depth, but I think, that before, the node_modules have been copied from the root of the repository.
This doesn't work anymore. It looks that is because we're already using the latest version of yarn. It does not support the workspaceRoot config entry, which leads to the workspace root and the package.json located there not being recognized.
With npmRebuild this would lead to a situation for the node_modules folder in the app/resources folder would not exist after a build.
I haven't found a workaround for this.
• writing effective config file=.build-tmp\my-project\output\builder-effective-config.yaml
• no event listeners found event=beforePack
• packageManager field detected in package.json resolvedPackageManager=yarn-berry [email protected] cwd=D:\Git\my-monorepo\dev-update-deps-2025-11-25\.build-tmp\my-project\input
• spawning command=yarn config get workspaceRoot cwd=D:\Git\my-monorepo\dev-update-deps-2025-11-25\.build-tmp\my-project\input
• exited command=yarn code=1 pid=15232 out=Usage Error: Couldn't find a configuration settings named "workspaceRoot"
$ yarn config get [--why] [--json] [--no-redacted] <name>
• workspace root not detected, using project root root=D:\Git\my-monorepo\dev-update-deps-2025-11-25\.build-tmp\my-project\input
• packageManager field detected in package.json resolvedPackageManager=yarn-berry [email protected] cwd=D:\Git\my-monorepo\dev-update-deps-2025-11-25\.build-tmp\my-project\input
• installing dependencies pm=yarn-berry platform=linux arch=x64 projectDir=D:\Git\my-monorepo\dev-update-deps-2025-11-25\.build-tmp\my-project\input appDir=D:\Git\my-monorepo\dev-update-deps-2025-11-25\.build-tmp\my-project\input workspaceRoot=D:\Git\my-monorepo\dev-update-deps-2025-11-25\.build-tmp\my-project\input
Oh, can you test 26.3.3? Curious if this was fixed already in https://github.com/electron-userland/electron-builder/pull/9376
If still isn't working, can you please provide a minimum repro repo?
Related Q, what does yarn config get projectRoot return for you?
yarn config get projectRoot
@mmaietta Thanks for the response!!
We're actually using 26.3.3 now.
I've created two repositories - one with the old (25.1.8) and one with the latest version of electron-builder.
- https://github.com/jochenschmich-aeberle/electron-builder-before-9395
- https://github.com/jochenschmich-aeberle/electron-builder-after-9395
Please see the README.MD in each of the repositories.
The difference in the output is, that the node_modules folder will be created with version 25.1.8 (in contrast to the latest version).
Our setup is basically just as it's shown in these repositories. We didn't use Workspaces until now and we're not keen on using them just for building the Electron app.
25.1.8 seemed to have an alternative way of determining where to get its node_modules from.
We'd also be happy with a configuration option that would allow us to set a path on where to resolve the node modules.
BTW: yarn config get projectRoot will return:
Usage Error: Couldn't find a configuration settings named "projectRoot"
$ yarn config get [--why] [--json] [--no-redacted] <name>
Can you please try 26.3.4? Looks to be resolved
yarn && yarn buildElectronApp
Hi @mmaietta - thanks for the update!
Sorry, not for me - when I:
- Checkout https://github.com/jochenschmich-aeberle/electron-builder-after-9395
- Upgrade to 26.3.4
- Run
yarn run buildElectronApp
...everything just stays the same. No node_modules in resources/app.
What would help us most (at least from what I've seen so far), would be an option that would allow us to modify the list of search directories for node_modules:
https://github.com/electron-userland/electron-builder/blob/05e0bc7becf4057e7f7794597a57f33d23894f4b/packages/app-builder-lib/src/util/appFileCopier.ts#L185
I could be wrong of course.
Right now, electron-builder is relying on the user having a yarn Workspaces configured.
This is not the case for every setup, I'd suppose - at least not for ours.
Right now, electron-builder is relying on the user having a yarn Workspaces configured.
That should be incorrect? Multiple package managers are being supported (npm, yarn classic, yarn 2+, pnpm, bun).
What search directory are you attempting to specify differently? projectDir (normally cwd() unless specified in config projectDir property) either contains appDir (per electron-builder app config prop) or is the appDir itself
The workspace error being logged was a red herring. Resolved in https://github.com/electron-userland/electron-builder/pull/9415
@mmaietta Thanks for your response - no, I don't think, that it's incorrect. It's good, that so many package managers are support and I believe that it's a tough task keeping everything current.
It's just, that our setup has worked in https://github.com/jochenschmich-aeberle/electron-builder-before-9395 and won't work in https://github.com/jochenschmich-aeberle/electron-builder-after-9395 - even though we didn't ever use the yarn workspaces feature and the node packages have still been resolved from the root directory.
We don't use the recommended project layout because we're shipping several different Electron distributables - not just one. The Electron apps aren't our only distributable - our products are also shipped as Docker images.
Our layout looks more like this:
root | dist |__ bundled-js-code <- will be included in Docker images and Electron Apps |__ app1_output <- where electron-builder puts the output files for app1 |__ app2_output <- where electron-builder puts the output files for app2 |_ src |_ electron-build |__ app1 <- project dir |__ app2 <- project dir
I'm sure, that it's not perfect and maybe not laid out as intended, but it worked until 26.x.
Of course we're willing to change things, but right now I'm out of ideas how to make it work.
Hmmm, trying to test this locally. I'm unable to reproduce the issue in after-9395 repo for some reason.
See ls dist/electron-app/win-arm64-unpacked/resources/app/node_modules
~/D/electron-builder-after-9395> yarn buildElectronApp
• electron-builder version=26.3.3 os=25.1.0
• loaded configuration file=/Users/mm/Development/electron-builder-after-9395/electron-build/electron-builder.yml
• description is missed in the package.json appPackageFile=/Users/mm/Development/electron-builder-after-9395/electron-build/package.json
• author is missed in the package.json appPackageFile=/Users/mm/Development/electron-builder-after-9395/electron-build/package.json
• writing effective config file=dist/electron-app/builder-effective-config.yaml
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=win32 arch=arm64 electron=36.8.1 appOutDir=dist/electron-app/win-arm64-unpacked
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• packageManager field detected in package.json resolvedPackageManager=yarn-berry [email protected] cwd=/Users/mm/Development/electron-builder-after-9395/electron-build
• unable to process dependency tree, falling back to using manual node_modules traversal pm=yarn-berry parser=npm error=Unexpected end of JSON input
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• default Electron icon is used reason=application icon is not set
• signing with signtool.exe path=dist/electron-app/win-arm64-unpacked/Electron Application.exe
• building target=zip arch=arm64 file=dist/electron-app/Electron Application-1.0.0-arm64-win.zip
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=linux arch=arm64 electron=36.8.1 appOutDir=dist/electron-app/linux-arm64-unpacked
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• unable to process dependency tree, falling back to using manual node_modules traversal pm=yarn-berry parser=npm error=Unexpected end of JSON input
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• building target=zip arch=arm64 file=dist/electron-app/electron-application-1.0.0-arm64.zip
~/D/electron-builder-after-9395> ls dist/electron-app/win-arm64-unpacked/resources/app/
/Users/mm/Development/electron-builder-after-9395
total 24
drwxr-xr-x 6 mm staff 192 Dec 6 11:20 .
drwxr-xr-x 3 mm staff 96 Dec 6 11:20 ..
-rw-r--r-- 1 mm staff 269 Dec 6 11:20 index.html
-rw-r--r-- 1 mm staff 2031 Dec 6 11:20 index.js
drwxr-xr-x 70 mm staff 2240 Dec 6 11:20 node_modules
-rw-r--r-- 1 mm staff 182 Dec 6 11:20 package.json
~/D/electron-builder-after-9395> ls dist/electron-app/win-arm64-unpacked/resources/app/node_modules
/Users/mm/Development/electron-builder-after-9395
total 0
drwxr-xr-x 70 mm staff 2240 Dec 6 11:20 .
drwxr-xr-x 6 mm staff 192 Dec 6 11:20 ..
drwxr-xr-x 6 mm staff 192 Dec 6 11:20 accepts
drwxr-xr-x 11 mm staff 352 Dec 6 11:20 async-function
drwxr-xr-x 11 mm staff 352 Dec 6 11:20 async-generator-function
drwxr-xr-x 6 mm staff 192 Dec 6 11:20 body-parser
drwxr-xr-x 6 mm staff 192 Dec 6 11:20 bytes
drwxr-xr-x 12 mm staff 384 Dec 6 11:20 call-bind-apply-helpers
drwxr-xr-x 7 mm staff 224 Dec 6 11:20 call-bound
drwxr-xr-x 6 mm staff 192 Dec 6 11:20 content-disposition
drwxr-xr-x 6 mm staff 192 Dec 6 11:20 content-type
...more files
Hi @mmaietta - thanks for trying again.
There truly seems to be a difference - here's my output:
D:\Git\reproduction-repos\electron-builder-after-9395 [main ≡]> yarn run buildElectronApp
(node:13544) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
• electron-builder version=26.3.3 os=10.0.26100
• loaded configuration file=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\electron-builder.yml
• description is missed in the package.json appPackageFile=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\package.json
• author is missed in the package.json appPackageFile=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\package.json
• writing effective config file=dist\electron-app\builder-effective-config.yaml
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=win32 arch=x64 electron=36.8.1 appOutDir=dist\electron-app\win-unpacked
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• packageManager field detected in package.json resolvedPackageManager=yarn-berry [email protected] cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build
• no node modules returned while searching directories searchDirectories=["electron-build"]
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• default Electron icon is used reason=application icon is not set
• signing with signtool.exe path=dist\electron-app\win-unpacked\Electron Application.exe
• building target=zip arch=x64 file=dist\electron-app\Electron Application-1.0.0-win.zip
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=linux arch=x64 electron=36.8.1 appOutDir=dist\electron-app\linux-unpacked
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• no node modules returned while searching directories searchDirectories=["electron-build"]
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• building target=zip arch=x64 file=dist\electron-app\electron-application-1.0.0.zip
D:\Git\reproduction-repos\electron-builder-after-9395 [main ≡]> ls .\dist\electron-app\win-unpacked\resources\app\
Verzeichnis: D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\win-unpacked\resources\app
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 04.12.2025 09:01 280 index.html
-a---- 08.12.2025 07:15 2031 index.js
-a---- 08.12.2025 07:15 182 package.json
D:\Git\reproduction-repos\electron-builder-after-9395 [main ≡]>
The most notable lines seem to be:
On your machine: unable to process dependency tree, falling back to using manual node_modules traversal pm=yarn-berry parser=npm error=Unexpected end of JSON input
On my machine: no node modules returned while searching directories searchDirectories=["electron-build"]
Okay, I'm going to need build logs with DEBUG=electron-builder added. You're running with corepack enabled, correct?
Please copy-paste or attach a log.txt if it's exceptionally long. Looking to see what is debug-logged during the module collection phase and which directories it's searching from.
unable to process dependency tree, falling back to using manual node_modules traversal
This is expected for yarn-berry, as there's no CLI for yarn-berry to fetch node module structure, so it attempts to pull with npm as parser, (which fails with packageManager set to yarn), and so then it falls back to manual traversal.
Hi @mmaietta! Thanks - yes, I'm running with corepack.
D:\Git\reproduction-repos\electron-builder-after-9395 [main ≡ +1 ~1 -0 !]> yarn run buildElectronApp
(node:11888) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
• electron-builder version=26.3.3 os=10.0.26100
• loaded configuration file=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\electron-builder.yml
• effective config config=directories:
output: ../dist/electron-app
buildResources: build
productName: Electron Application
appId: electron-application
copyright: Reproduction Repos ACME Corp. All rights reserved.
win:
target:
- zip
linux:
target:
- zip
category: Science
asar: false
files:
- filter:
- '*.json'
- from: ../dist/app
filter:
- '*.js'
- '*.html'
npmRebuild: false
• description is missed in the package.json appPackageFile=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\package.json
• author is missed in the package.json appPackageFile=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\package.json
• writing effective config file=dist\electron-app\builder-effective-config.yaml
• no event listeners found event=beforePack
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=win32 arch=x64 electron=36.8.1 appOutDir=dist\electron-app\win-unpacked
• no custom electronDist provided, unpacking default Electron distribution
• spawning command=D:\Git\reproduction-repos\electron-builder-after-9395\node_modules\app-builder-bin\win\x64\app-builder.exe unpack-electron --configuration [{"platform":"win32","arch":"x64","version":"36.8.1"}] --output D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\win-unpacked --distMacOsAppName Electron.app
• map async taskCount=2
• map async taskCount=1
• map async taskCount=73
• exited command=app-builder.exe code=0 pid=3036
• no event listeners found event=afterExtract
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• packageManager field detected in package.json resolvedPackageManager=yarn-berry [email protected] cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build
• spawning command=yarn config get workspaceRoot cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build
• exited command=yarn code=1 pid=25260 out=Usage Error: Couldn't find a configuration settings named "workspaceRoot"
$ yarn config get [--why] [--json] [--no-redacted] <name>
• workspace root not detected, using project root root=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build
• spawning node module collector process command=yarn args=["config","--json"] cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build tempOutputFile=C:\Users\Schmich\AppData\Local\Temp\t-HCA1h3\exec--0.txt
• failed to execute command error=Node module collector spawn failed: spawn yarn ENOENT
• Yarn config returned no output, assuming default Yarn v1 behavior (hoisted, non-PnP)
• spawning node module collector process command=cmd.exe args=["/c","C:\\Users\\Schmich\\AppData\\Local\\Temp\\t-HCA1h3\\npm-2.bat","list","-a","--include","prod","--include","optional","--omit","dev","--json","--long","--silent"] cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build tempOutputFile=C:\Users\Schmich\AppData\Local\Temp\t-HCA1h3\npm-1-output.json
• `npm list` returned non-zero exit code, but it MIGHT be expected (https://github.com/npm/npm/issues/17624). Check stderr for details.
• cannot find path for dependency name=undefined reference=undefined
• node modules collection complete packageName=electron-application depCount=0
• no node modules returned while searching directories searchDirectories=["electron-build"]
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• spawning command=D:\Git\reproduction-repos\electron-builder-after-9395\node_modules\app-builder-bin\win\x64\app-builder.exe icon --format ico --root D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\build --root D:\Git\reproduction-repos\electron-builder-after-9395\electron-build --out D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\.icon-ico
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\build\icon.ico
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\icon.ico
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\build\icons
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\icons
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\build\icon.png
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\icon.png
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\build\icon.icns
• path doesn't exist path=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build\icon.icns
• no icons found, using provided fallback sources
• exited command=app-builder.exe code=0 pid=25088 out={"icons":null,"isFallback":true}
• default Electron icon is used reason=application icon is not set
• spawning command=D:\Git\reproduction-repos\electron-builder-after-9395\node_modules\app-builder-bin\win\x64\app-builder.exe rcedit --args ["D:\\Git\\reproduction-repos\\electron-builder-after-9395\\dist\\electron-app\\win-unpacked\\Electron Application.exe","--set-version-string","FileDescription","Electron Application","--set-version-string","ProductName","Electron Application","--set-version-string","LegalCopyright","Reproduction Repos ACME Corp. All rights reserved.","--set-file-version","1.0.0","--set-p 6d0081ca656f9e22d40a2c62b8c4a42ec61489aaa8e6ac5adbd1b1e438be9817 (sha256 hash) (sha256 hash) Application","--set-version-string","OriginalFilename",""]
• found existing path=C:\Users\Schmich\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0
• execute command command='C:\Users\Schmich\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\rcedit-x64.exe' 'D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\win-unpacked\Electron Application.exe' --set-version-string FileDescription 'Electron Application' --set-version-string ProductName 'Electron Application' --set-version-string LegalCopyright 'Reproduction Repos ACME Corp. All rights reserved.' --set-file-version 1.0.0 --set-product-version 1.0.0.0 --set-version-string InternalName 'Electron Application' --set-version-string OriginalFilename ''
workingDirectory=
• command executed executable=C:\Users\Schmich\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\rcedit-x64.exe
• exited command=app-builder.exe code=0 pid=22028
• signing with signtool.exe path=dist\electron-app\win-unpacked\Electron Application.exe
• no signing info identified, signing is skipped signHook=false cscInfo=null
wine&sign: 2s 983ms
• no event listeners found event=afterSign
• building target=zip arch=x64 file=dist\electron-app\Electron Application-1.0.0-win.zip
• no event listeners found event=artifactBuildStarted
• no event listeners found event=beforePack
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=linux arch=x64 electron=36.8.1 appOutDir=dist\electron-app\linux-unpacked
• no custom electronDist provided, unpacking default Electron distribution
• spawning command=D:\Git\reproduction-repos\electron-builder-after-9395\node_modules\app-builder-bin\win\x64\app-builder.exe unpack-electron --configuration [{"platform":"linux","arch":"x64","version":"36.8.1"}] --output D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\linux-unpacked --distMacOsAppName Electron.app
• executing file=D:\Git\reproduction-repos\electron-builder-after-9395\node_modules\7zip-bin\win\x64\7za.exe args=a -bd -mx=7 -mtc=off -mm=Deflate -mcu D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\Electron Application-1.0.0-win.zip . cwd=D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\win-unpacked
• map async taskCount=2
• map async taskCount=1
• map async taskCount=74
• exited command=app-builder.exe code=0 pid=19784
• no event listeners found event=afterExtract
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• spawning node module collector process command=yarn args=["config","--json"] cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build tempOutputFile=C:\Users\Schmich\AppData\Local\Temp\t-HCA1h3\exec--3.txt
• failed to execute command error=Node module collector spawn failed: spawn yarn ENOENT
• Yarn config returned no output, assuming default Yarn v1 behavior (hoisted, non-PnP)
• spawning node module collector process command=cmd.exe args=["/c","C:\\Users\\Schmich\\AppData\\Local\\Temp\\t-HCA1h3\\npm-5.bat","list","-a","--include","prod","--include","optional","--omit","dev","--json","--long","--silent"] cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build tempOutputFile=C:\Users\Schmich\AppData\Local\Temp\t-HCA1h3\npm-4-output.json
• `npm list` returned non-zero exit code, but it MIGHT be expected (https://github.com/npm/npm/issues/17624). Check stderr for details.
• cannot find path for dependency name=undefined reference=undefined
• node modules collection complete packageName=electron-application depCount=0
• no node modules returned while searching directories searchDirectories=["electron-build"]
• getPublishConfigsForUpdateInfo: no publishConfigs, detect using repository info
• asar usage is disabled — this is strongly not recommended solution=enable asar and use asarUnpack to unpack files that must be externally available
• building target=zip arch=x64 file=dist\electron-app\electron-application-1.0.0.zip
• no event listeners found event=artifactBuildStarted
• executing file=D:\Git\reproduction-repos\electron-builder-after-9395\node_modules\7zip-bin\win\x64\7za.exe args=a -bd -mx=7 -mtc=off -mm=Deflate -mcu D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\electron-application-1.0.0.zip . cwd=D:\Git\reproduction-repos\electron-builder-after-9395\dist\electron-app\linux-unpacked
• no event listeners found event=artifactBuildCompleted
• no event listeners found event=artifactBuildCompleted
What does yarn config --json return for you? My local logs show this in the DEBUG electron-builder logs. Your yarn config --json command seems to be failing. Could be the smoking gun, or maybe just a red herring though.
• workspace root not detected, using project root root=/Users/mikemaietta/Development/electron-builder-after-9395/electron-build
• spawning node module collector process command=yarn args=["config","--json"] cwd=/Users/mikemaietta/Development/electron-builder-after-9395/electron-build tempOutputFile=/private/var/folders/y3/r1xf5xzn5pddms2gslqh14sh0000gn/T/t-LcwbAs/exec--0.txt
• spawning node module collector process command=npm args=["list","-a","--include","prod","--include","optional","--omit","dev","--json","--long","--silent"] cwd=/Users/mikemaietta/Development/electron-builder-after-9395/electron-build tempOutputFile=/private/var/folders/y3/r1xf5xzn5pddms2gslqh14sh0000gn/T/t-LcwbAs/npm-1-output.json
• `npm list` returned non-zero exit code, but it MIGHT be expected (https://github.com/npm/npm/issues/17624). Check stderr for details.
• note: there was node module collector output on stderr stderr=This project is configured to use yarn because /Users/mikemaietta/Development/electron-builder-after-9395/electron-build/package.json has a "packageManager" field
• spawning node module collector process command=yarn args=["config","--json"] cwd=D:\Git\reproduction-repos\electron-builder-after-9395\electron-build tempOutputFile=C:\Users\Schmich\AppData\Local\Temp\t-HCA1h3\exec--0.txt
• failed to execute command error=Node module collector spawn failed: spawn yarn ENOENT
Related note, can you retry with 26.3.5? Some additional fixes went out, curious if it (hopefully) also resolves your issue.
Wait a sec, you're packaging on Windows. Can you try linux docker container (or on a mac if you have one available). Wondering now if this is a difference in build environments since I'm testing from mac
yarn config --json seems to work just fine, when executed in PowerShell from the workspace root: yarn-config-json.txt
Works OK from the subdirectory, too: yarn-config-json-from-electron-build-subdir.txt
Here's the output, when running the command from inside WSL (hope that's sufficient): log-wsl.txt
I've tried 26.3.4 and 26.3.5 as soon as they got released. Didn't bring any resolution.
I'll update the repro-repo to the latest version anyway.
Always need logs with DEBUG=electron-builder set otherwise I can't debug the module collector (it's always debug to avoid significantly polluting the logs (it iterates searching from multiple root directories).
Update from my side: I just tried building the app on MacOS target with 26.3.6 and was able to run the app successfully. Screenshot below of running app and ls node_modules
Hmmmm, this seems like the culprit but I'm struggling to understand why your environment results differs from mine.
cannot find path for dependency name=undefined reference=undefined
What does echo $COREPACK_ENABLE_STRICT return for you? If 0, try resetting it to empty COREPACK_ENABLE_STRICT="" yarn electron-builder ...etc
Hmmmm, this seems like the culprit but I'm struggling to understand why your environment results differs from mine.
cannot find path for dependency name=undefined reference=undefinedWhat does
echo $COREPACK_ENABLE_STRICTreturn for you? If0, try resetting it to emptyCOREPACK_ENABLE_STRICT="" yarn electron-builder ...etc
Here is the log (when ran with COREPACK_ENABLE_STRICT=''). Hasn't been set to 0 on my machine, though.
Looking at the following location:
• checking for potential workspace root path=/mnt/d/Git/reproduction-repos/electron-builder-after-9395/electron-build
• checking for potential workspace root path=/mnt/d/Git/reproduction-repos/electron-builder-after-9395
• checking for potential workspace root path=/mnt/d/Git/reproduction-repos
• checking for potential workspace root path=/mnt/d/Git
• checking for potential workspace root path=/mnt/d
• checking for potential workspace root path=/mnt
• checking for potential workspace root path=/
If I understand correctly, the code is looking for a package.json that defines the root of the Yarn Workspace.
In our case we don't work with workspaces and we'd like to avoid it as we don't necessarily want and need to leverage its mechanisms.
In the older versions of electron-builder (25.* and below), the code also went looking for a node_modules folder regardless of any workspace definitions - at least that's my perception.
Anyway: Thanks again @mmaietta For looking into this!
Hmmm, nothing there sticks out to me. If that recursive search doesn't find a potential root via package.json, it uses the supplied base search directory that the project or app is set to. Also, it is not implying that you need to use a yarn workspace (or any specific package manager setup tbh); it's something I need to check/detect for, but nothing here requires it to be used.
In the older versions of electron-builder (25.* and below), the code also went looking for a node_modules folder regardless of any workspace definitions - at least that's my perception.
This code still exists. Workspace definitions are just an additional approach of checking. https://github.com/electron-userland/electron-builder/blob/5f962f9cae875da1208caa96fe040b2fe9224ea7/packages/app-builder-lib/src/util/yarn.ts#L30-L36
I've merged in a new PR that swaps in npm list support for yarn berry by overriding corepack's strict mode when collecting the node modules. https://github.com/electron-userland/electron-builder/pull/9443
Most notable changes - more files are added into the asar for yarn berry per the updated test snapshot.
I'll try the new version as soon as it's released (soonest time is tomorrow morning, though - CET).
As for the lookup of node_modules: I might be mistaken, but if I check https://github.com/jochenschmich-aeberle/electron-builder-before-9395, I notice that the repository root is neither used as appDir, nor as projectDir - but still, the node_modules folder in the repo root is being used as the source for the node modules. Maybe there's another facet to it. That's the log output from the builder task run with 25.*: log-wsl.txt
Does not tell how node_modules is chosen in the older version, unfortunately - at least I can't tell from the log.
Nevertheless - I'll try the new version as soon as I can. Thanks for handling things so quick.