forge: electron-forge does not work with yarn workspaces
- 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 +1ms
An 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/*"
]
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 24 (7 by maintainers)
Commits related to this issue
- fix: delete gist files on update (#869) — committed to electron/forge by codebytere 3 years ago
Had the same problem. Fixed this by moving
electronpackage from./node_modulesto./packages/app/node_modulesusingyarn 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": trueis importantI am using the
typescripttemplate https://www.electronforge.io/templates/typescript-template. I think it is webpack that is causing problem. I am having problems with other modules when loaded by webpack.Mmmh, I am using
6.0.0-beta.50It bugged with my simple symlink in the end, I used @alxmiron 's solution with noihoist. It is working well
So I have a fix for this particular issue, but I can guarantee that this will not work out-of-the-box once you get to the
packagephase. I’ve made several comments on this topic in https://github.com/electron-userland/electron-packager/issues/774. TL;DR: you’ll need to add a PackagerafterCopyhook to runyarn install --productionin the app directory.