electron-forge does not work with yarn workspaces
See original GitHub issue- 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.
Since I use Yarn workspaces electron-forge complains about missing dependencies which are installed through yarn in parent folder. My directory structure is as following:
omnicrom/
├─ node_modules/
│ ├──.bin/
│ ├── electron-forge
│ ├── electron
│ └── ...
├─ .../
└─ packages/
└─ app/
├── .../
├── node_modules/
│ └──.bin/
└── src/
Console Output (with stack)
WARNING: DEBUG environment variable detected. Progress indicators will be sent over electron-forge:lifecycle electron-forge:lifecycle Process Started: Checking your system +0ms electron-forge:lifecycle Process Succeeded: Checking your system +517ms electron-forge:runtime-config setting key: verbose to value: false +0ms WARNING: DEBUG environment variable detected. Progress indicators will be sent over electron-forge:lifecycle electron-forge:lifecycle Process Started: Locating Application +0ms electron-forge:project-resolver searching for project in: D:\projects\crm\omnicrom\packages\app +0ms electron-forge:project-resolver electron-forge compatible package.json found in D:\projects\crm\omnicrom\packages\app\package.json +7ms electron-forge:lifecycle Process Succeeded: Locating Application +10ms electron-forge:util Could not read package.json for moduleName=electron-prebuilt-compile [Error: ENOENT: no such file or directory, open 'D:\projects\crm\omnicrom\packages\app\node_modules\electron-prebuilt-compile\package.json'] { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'D:\\projects\\crm\\omnicrom\\packages\\app\\node_modules\\electron-prebuilt-compile\\package.json' } +0ms electron-forge:util Could not read package.json for moduleName=electron [Error: ENOENT: no such file or directory, open 'D:\projects\crm\omnicrom\packages\app\node_modules\electron\package.json'] { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'D:\\projects\\crm\\omnicrom\\packages\\app\\node_modules\\electron\\package.json' } +4ms electron-forge:util Could not read package.json for moduleName=electron-prebuilt [Error: ENOENT: no such file or directory, open 'D:\projects\crm\omnicrom\packages\app\node_modules\electron-prebuilt\package.json'] { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'D:\\projects\\crm\\omnicrom\\packages\\app\\node_modules\\electron-prebuilt\\package.json' } +2ms electron-forge:util getElectronVersion failed to determine Electron version: projectDir=D:\projects\crm\omnicrom\packages\app, result=null +1msAn unhandled rejection has occurred inside Forge: Could not determine Electron version. Make sure that ‘npm install’ (or ‘yarn’) has been run before invoking electron-forge. Error: Could not determine Electron version. Make sure that ‘npm install’ (or ‘yarn’) has been run before invoking electron-forge. at D:\projects\crm\omnicrom\node_modules\electron-forge\dist\util\rebuild.js:26:13 at Generator.next (<anonymous>) at Generator.tryCatcher (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\util.js:16:23) at PromiseSpawn._promiseFulfilled (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\generators.js:97:49) at D:\projects\crm\omnicrom\node_modules\bluebird\js\release\generators.js:201:15 at D:\projects\crm\omnicrom\node_modules\electron-forge\dist\util\rebuild.js:63:17 at D:\projects\crm\omnicrom\node_modules\electron-forge\dist\api\start.js:105:33 at Generator.next (<anonymous>) at Generator.tryCatcher (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\util.js:16:23) at PromiseSpawn._promiseFulfilled (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\generators.js:97:49) at Promise._settlePromise (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\promise.js:574:26) at Promise._settlePromise0 (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\promise.js:614:10) at Promise._settlePromises (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\promise.js:694:18) at _drainQueueStep (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\async.js:138:12) at _drainQueue (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\async.js:131:9) at Async._drainQueues (D:\projects\crm\omnicrom\node_modules\bluebird\js\release\async.js:147:5)
What command line arguments are you passing?
none.
What does your config.forge
data in package.json
look like?
config.forge settings
"config": { "forge": { "make_targets": { "win32": [ "squirrel" ], "darwin": [ "zip" ], "linux": [ "deb", "rpm" ] }, "electronPackagerConfig": { "packageManager": "yarn" }, "electronWinstallerConfig": { "name": "omnicrom" }, "electronInstallerDebian": {}, "electronInstallerRedhat": {}, "github_repository": { "owner": "", "name": "" }, "windowsStoreConfig": { "packageName": "", "name": "omnicrom" } } }
To recreate this issue simply create a new project with electron-forge and then wrap it into a yarn workspace. to do this you refer to this guide: https://yarnpkg.com/en/docs/workspaces You could also recreate my directory structure and use the following root package.json contents:
{
"name": "myrootpackage",
"version": "1.0.0",
"private": true,
"workspaces": [
"packages/*"
]
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:23 (7 by maintainers)
Top GitHub Comments
Had the same problem. Fixed this by moving
electron
package from./node_modules
to./packages/app/node_modules
usingyarn workspaces.noihoist
@abumalick has correct testcase - I also get an error
"electron package not found"
there, unless I add the following props tomy-new-app/package.json
:NOTE:
"private": true
is important