forge: Production pruning fails when `yarn` is used to install and `npm@5` is used to prune
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
I can’t believe that others have this problem, too. But I really don’t know what else could I test. Here is my minimal example to reproduce the problem (I am using OSX):
$ node --version && npm --version && yarn --version && electron-forge --version
v8.0.0
5.0.1
0.24.5
✔ Checking your system
3.0.5
$ mkdir test
$ cd test
$ electron-forge init
✔ Checking your system
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
$ yarn make
yarn make v0.24.5
$ electron-forge make
✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets:
✔ Making for target: zip - On platform: darwin - For arch: x64
✨ Done in 15.52s.
$ open out/test-darwin-x64/test.app
So I created a fresh project from scratch, package it and try to open the resulting app. But I get the following error:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'electron-compile'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (/Users/choffmeister/test/out/test-darwin-x64/test.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/choffmeister/test/out/test-darwin-x64/test.app/Contents/Resources/app/es6-shim.js:4:23)
at Object.<anonymous> (/Users/choffmeister/test/out/test-darwin-x64/test.app/Contents/Resources/app/es6-shim.js:10:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
Investigating the folder of the app I find, that the folder out/test-darwin-x64/test.app/Contents/Resources/app/node_modules
is empty.
Is this an OSX problem?
Thanks for your help!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 45 (19 by maintainers)
Commits related to this issue
- Merge pull request #249 from electron/update-dependencies chore: Update all dependencies — committed to electron/forge by felixrieseberg 5 years ago
As @MarshallOfSound suggested, adding
"packageManager": "yarn"
to"electronPackagerConfig"
solved the issues for me.The other thing you guys can try is setting
yarn
to be the tool used for pruning packages.packageManager: 'yarn'
https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#packagemanager
Ok so
config.forge.electronPackagerConfig.packageManager
, notforge.config.electronPackagerConfig.packageManager