forge: With no changes, "Cannot find module 'appdmg'"
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
6.4.1
Electron version
v24.8.1
Operating system
macOS 11.3.1
Last known working Electron Forge version
6.1.1
Expected behavior
Our build is running in Circle CI, and without changes recently this issue happens. We’ve tried pegging the @electron-forge modules to 6.1.1, but the issue remains.
Any recent changes in forge that could cause the Cannot find module 'appdmg' error?
Actual behavior
electron-forge:hook hook triggered: postPackage +20s
[SUCCESS] Running postPackage hook
[SUCCESS] Running package command
[STARTED] Running preMake hook
electron-forge:hook hook triggered: preMake +1ms
[SUCCESS] Running preMake hook
[STARTED] Making distributables
electron-forge:hook hook triggered: readPackageJson +1ms
[STARTED] Making a dmg distributable for darwin/x64
[FAILED] Cannot find module 'appdmg'
[FAILED] Require stack:
[FAILED] - /Users/distiller/repo/node_modules/electron-installer-dmg/src/index.js
[FAILED] - /Users/distiller/repo/node_modules/@electron-forge/maker-dmg/dist/MakerDMG.js
[FAILED] - /Users/distiller/repo/node_modules/@electron-forge/core/dist/util/require-search.js
[FAILED] - /Users/distiller/repo/node_modules/@electron-forge/core/dist/util/plugin-interface.js
[FAILED] - /Users/distiller/repo/node_modules/@electron-forge/core/dist/util/forge-config.js
[FAILED] - /Users/distiller/repo/node_modules/@electron-forge/core/dist/util/index.js
[FAILED] - /Users/distiller/repo/node_modules/@electron-forge/core/dist/api/index.js
[FAILED] - /Users/distiller/repo/node_modules/@electron-forge/cli/dist/electron-forge-publish.js
### Steps to reproduce
Unknown
### Additional information
_No response_
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 17
- Comments: 20 (6 by maintainers)
Thanks! It works for me:
Had the same issue on Mac. After hrs of tinkering, I tried to install the package manually via
npm i -D appdmgand it failed, complaining about my python version 3.12. So, I changed my global python version to 3.11.4 viaAnd its working fine now. Hope this helps anyone else.
This is happening in my GitHub actions as well, Ive found that it correlates to the version of the Github runner.
macos-12: 20231029.1 causes a failure macos-12: 20230921.1 produces a valid build
Hello, I have the same issue and would like to add some insight I gained while losing my sanity while investigating this issue.
I encountered this issue while working on chainner. I noticed that this Github actions workflow suddenly started failing on macOS when I changed a file totally unrelated to the workflow. I got the same error message as @busterbogheart:
While investigating this issue, I found 2 main things:
Firstly, the issue is definitely related to caches. Removing the
cache: 'npm'from the workflow consistently triggered the issue.Secondly, I noticed the logs of all successful and failed builds were identical until the
Cannot find module 'appdmg'except for one detail: native dependencies. Here’s the diff of 2 logs (one successful one not):As we can see, the successful runs always prepare one native dependency, while the failed runs do not. This native dependency is specific to macOS (my windows and linux runs never have it), so I suspect that
appdmgis the native dependency.Got this locally after upgrading Python via Homebrew. The fix for me was:
brew upgrade python-setuptoolsrm -rf node_modulesnpm installThen the build worked.
Here is the fix if you want to keep 3.12 (github action default python versions) https://github.com/LinusU/node-appdmg/issues/234