Repository navigation
Closed
Description
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.0.0-beta.70
Electron version
v21.2.0
Operating system
Windows 10 Version 21H1 Build 19043.2130
Last known working Electron Forge version
6.0.0-beta.65
Expected behavior
After running the following commands
yarn create electron-app test --template=webpack
cd test
npm run start
then the empty application should start.
Actual behavior
test>npm run start
[email protected] start
electron-forge start
√ Checking your system
√ Locating Application
An unhandled rejection has occurred inside Forge:
Error: package.json for app does not have any devDependencies
Electron Forge was terminated. Location:
{}
Steps to reproduce
See above
Additional information
Running node_modules\.bin\electron-forge --version returns this:
√ Checking your system
6.0.0-beta.70
However according to packages.json it's beta.69 that's installed.
{
"name": "test",
"productName": "test",
"version": "1.0.0",
"description": "My Electron application description",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "cwellsx",
"email": "[email protected]"
},
"license": "MIT",
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.69",
"@electron-forge/maker-deb": "^6.0.0-beta.69",
"@electron-forge/maker-rpm": "^6.0.0-beta.69",
"@electron-forge/maker-squirrel": "^6.0.0-beta.69",
"@electron-forge/maker-zip": "^6.0.0-beta.69",
"@electron-forge/plugin-webpack": "6.0.0-beta.69",
"@vercel/webpack-asset-relocator-loader": "1.7.3",
"css-loader": "^6.0.0",
"electron": "21.2.0",
"node-loader": "^2.0.0",
"style-loader": "^3.0.0"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0"
}
}Reacted by Edi Duluman
Activity
cwellsx commentedon Oct 29, 2022
I get the same error above trying to start the typescript template:
erikian commentedon Oct 29, 2022
Oddly, when I do a fresh install with
yarn create electron-app test2 --template=webpackon Windows, it pinsplugin-webpackto6.0.0-beta.64, not6.0.0-beta.69as OP. So the version I'm getting is also wrong, but different:{ "name": "test2", "productName": "test2", "version": "1.0.0", "description": "My Electron application description", "main": ".webpack/main", "scripts": { "start": "electron-forge start", "package": "electron-forge package", "make": "electron-forge make", "publish": "electron-forge publish", "lint": "echo \"No linting configured\"" }, "keywords": [], "license": "MIT", "config": { "forge": { "packagerConfig": {}, "makers": [ { "name": "@electron-forge/maker-squirrel", "config": { "name": "test2" } }, { "name": "@electron-forge/maker-zip", "platforms": [ "darwin" ] }, { "name": "@electron-forge/maker-deb", "config": {} }, { "name": "@electron-forge/maker-rpm", "config": {} } ], "plugins": [ [ "@electron-forge/plugin-webpack", { "mainConfig": "./webpack.main.config.js", "renderer": { "config": "./webpack.renderer.config.js", "entryPoints": [ { "html": "./src/index.html", "js": "./src/renderer.js", "name": "main_window", "preload": { "js": "./src/preload.js" } } ] } } ] ] } }, "devDependencies": { "@electron-forge/cli": "^6.0.0-beta.64", "@electron-forge/maker-deb": "^6.0.0-beta.64", "@electron-forge/maker-rpm": "^6.0.0-beta.64", "@electron-forge/maker-squirrel": "^6.0.0-beta.64", "@electron-forge/maker-zip": "^6.0.0-beta.64", "@electron-forge/plugin-webpack": "6.0.0-beta.64", "@vercel/webpack-asset-relocator-loader": "1.7.0", "css-loader": "^6.0.0", "electron": "21.2.0", "node-loader": "^2.0.0", "style-loader": "^3.0.0" }, "dependencies": { "electron-squirrel-startup": "^1.0.0" } }I'm getting a different error because of the old plugin syntax used in
beta-64:VerteDinde commentedon Oct 30, 2022
@cwellsx @erikian Thanks for the bug report and investigation! Will look into this - this specific error should have been fixed with the release of beta.70, so the older versions installing may well be in the issue 🤔
cwellsx commentedon Oct 31, 2022
I tried again just now: and the version installed according to
package.jsonis still beta.69.richardabear commentedon Oct 31, 2022
Hi guys, any manual fixes for the time being?
VerteDinde commentedon Oct 31, 2022
@richardabear The manual fix here should be making sure each
@electron-forgedependency is correctly set to latest (6.0.0-beta.70currently). We'll figure out why that's not updating correctly.VerteDinde commentedon Oct 31, 2022
@cwellsx @erikian I've tried to repro on several different computers, and the version is consistently being returned as 6.0.0-beta.70 🤔 Sorry, could you both let me know if you have a global install of electron-forge (
npm list -g), try blowing that away, and then re-initing a project?It does seem that when all dependencies are set to beta.70, the
yarncommands work as expected; I'm just trying to figure out why you're both seeing different versions of the wrong version.erikian commentedon Oct 31, 2022
No global
electron-forgehere:erikian commentedon Oct 31, 2022
@VerteDinde I found the issue. When
create-electron-appis installed, it installs forge as a dependency. Whencreate-electron-appis run, it calls@electron-forge\cli\dist\electron-forge-init.js, which ultimately copies the package.json fromcreate-electron-app's package.json and runsnpm install/yarn install.In other words: the forge version you get depends on when
create-electron-appwas first run on your system. The same applies for any other dependencies, like@vercel/webpack-asset-relocator-loaderas you can see in the comments above. Since@electron-forge/plugin-webpackis pinned in the package.json, that specific (and probably outdated) version is always installed.When I run
create-electron-appon npm instead of Yarn, I getbeta-59. You're getting the latest version because the computers you're testing on never rancreate-electron-appbefore.erikian commentedon Oct 31, 2022
Just submitted #3030 which unpins the version, so the most recent one will be installed. This doesn't change the outdated versions in the
package.jsonitself though, that seems to be a separate issue.XMLHexagram commentedon Oct 31, 2022
As a hack, I find add this to
package.json{ "config": { "forge":{} } }Can solve this problem.
More details, I think this is cause by
resolve-dirfunction in core/utils, which will guess which package.json is the best match(the package.json has config.forge is the best match or the highest package.json is the best match one). This is great. But it does not adapt config file.So when you use config file,
resolve-dirwill endless try to find upperpackage.jsonand use the most top levelpackage.jsonas working package.json.I think I fix this issue in #3029.
cwellsx commentedon Oct 31, 2022
I had hoped so. But doing that, and running npm install, doesn't fix the problem: I still have the same error. Perhaps my template itself needs updating? What does your package.json look like?
I don't think I have it:
erikian commentedon Oct 31, 2022
@cwellsx try
yarn global remove create-electron-app, then runyarn create electron-app test --template=webpackagainXMLHexagram commentedon Oct 31, 2022
@cwellsx Could you try my fix ? This works on my machine.

MarshallOfSound commentedon Oct 31, 2022
Fixed in b5d0587
cwellsx commentedon Oct 31, 2022
That installed
"@electron-forge/cli": "^6.0.0-beta.70"but I have the same error onnpm start.This displays a different error:
When I add this then

npm startis successful:The idea for doing that comes from the second list-item of https://www.electronforge.io/configuration which says, "a relative path":
DERRICK-TORKORNOO commentedon Jun 7, 2023
√ Checking your system
√ Locating application
√ Locating application
× Loading configuration
› Cannot find module 'electron-winstaller'
Require stack:
■ Preparing native dependencies
■ Running generateAssets hook
An unhandled rejection has occurred inside Forge:
Error: Cannot find module 'electron-winstaller'
Require stack:
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\derri\OneDrive\Documents\electron-2\app\node_modules@cspotcode\source-map-support\source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:920:27)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (C:\Users\derri\OneDrive\Documents\electron-2\app\node_modules@electron-forge\maker-squirrel\src\MakerSquirrel.ts:5:1)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.require.extensions. [as .js] (C:\Users\derri\OneDrive\Documents\electron-2\app\node_modules\ts-node\src\index.ts:1608:43)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (C:\Users\derri\OneDrive\Documents\electron-2\app\forge.config.ts:2:1)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module.m._compile (C:\Users\derri\OneDrive\Documents\electron-2\app\node_modules\ts-node\src\index.ts:1618:23)