[5.x] weird error when running "electron-forge start" without node_modules
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.
Please describe your issue:
I’m getting this error when I run electron-forge start
:
An unhandled error has occurred inside Forge:
Expected a string version for electron version, got a "object"
Error: Expected a string version for electron version, got a "object"
``
But the error is incorrect.
<!-- For bugs and questions, please answer these questions to the best of your ability. -->
**Console output when you run `electron-forge` with the environment variable `DEBUG=electron-forge:*`. (Instructions on how to do so [here](https://www.npmjs.com/package/debug#usage)). Please include the stack trace if one exists.**
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 +184ms 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: /home/spaceboyross/paradise-client +0ms electron-forge:project-resolver electron-forge compatible package.json found in /home/spaceboyross/paradise-client/package.json +19ms electron-forge:lifecycle Process Succeeded: Locating Application +20ms electron-forge:util Could not read package.json for moduleName=electron-prebuilt-compile { [Error: ENOENT: no such file or directory, open ‘/home/spaceboyross/paradise-client/node_modules/electron-prebuilt-compile/package.json’] errno: -2, code: ‘ENOENT’, syscall: ‘open’, path: ‘/home/spaceboyross/paradise-client/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 ‘/home/spaceboyross/paradise-client/node_modules/electron/package.json’] errno: -2, code: ‘ENOENT’, syscall: ‘open’, path: ‘/home/spaceboyross/paradise-client/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 ‘/home/spaceboyross/paradise-client/node_modules/electron-prebuilt/package.json’] errno: -2, code: ‘ENOENT’, syscall: ‘open’, path: ‘/home/spaceboyross/paradise-client/node_modules/electron-prebuilt/package.json’ } +0ms electron-forge:util getElectronVersion failed to determine Electron version: projectDir=/home/spaceboyross/paradise-client, result=null +0ms electron-forge:lifecycle Process Started: Preparing native dependencies +11ms electron-forge:lifecycle Process Failed: Preparing native dependencies +2ms
An unhandled error has occurred inside Forge: Expected a string version for electron version, got a “object” Error: Expected a string version for electron version, got a “object” at new Rebuilder (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/electron-rebuild/lib/src/rebuild.js:62:19) at rebuildWithOptions (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/electron-rebuild/lib/src/rebuild.js:316:23) at doRebuild (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/electron-rebuild/lib/src/rebuild.js:323:16) at /home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/dist/util/rebuild.js:27:57 at Generator.next (<anonymous>) at Generator.tryCatcher (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/util.js:16:23) at PromiseSpawn._promiseFulfilled (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/generators.js:97:49) at /home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/generators.js:201:15 at /home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/dist/util/rebuild.js:53:22 at _promise2.default (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/dist/util/ora-handler.js:46:5) at new Promise (<anonymous>) at new F (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/core-js/library/modules/_export.js:36:28) at asyncOra (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/dist/util/ora-handler.js:45:10) at /home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/dist/util/rebuild.js:25:36 at Generator.next (<anonymous>) at Generator.tryCatcher (/home/spaceboyross/.nvm/versions/node/v11.0.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/util.js:16:23)
**What command line arguments are you passing?**
**What does your `config.forge` data in `package.json` look like?**
“forge”: { “make_targets”: { “win32”: [ “squirrel” ], “darwin”: [ “zip” ], “linux”: [ “deb”, “rpm” ] }, “electronPackagerConfig”: { “packageManager”: “npm” }, “electronWinstallerConfig”: { “name”: “Paradise” }, “electronInstallerDebian”: {}, “electronInstallerRedhat”: {}, “github_repository”: { “owner”: “”, “name”: “” }, “windowsStoreConfig”: { “packageName”: “Paradise”, “name”: “paradise-client” } }
**Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using `electron-forge init` is a good starting point, if that is not the
source of your problem.**
Run `electron-forge start`
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (9 by maintainers)
Top GitHub Comments
OK, I know why this error happens. This is the error you get if you don’t run
npm install
(oryarn
, if you useyarn
) before runningelectron-forge start
.What you really should do instead of running the globally installed
electron-forge
is runnpm start
, sinceelectron-forge
is listed indevDependencies
. The globally installed Forge should only be used forinit
,import
, andinstall
subcommands, unless you have a really good reason.@Tapestes well, one problem is that you have different versions of Electron specified. Remove
electron
fromdependencies
and updateelectron-prebuilt-compile
to 3.0.10.… actually, I think that might be the problem.