Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid options object when running electron-forge start #2273

Closed
3 tasks done
atheck opened this issue May 18, 2021 · 5 comments
Closed
3 tasks done

Invalid options object when running electron-forge start #2273

atheck opened this issue May 18, 2021 · 5 comments
Labels

Comments

@atheck
Copy link

atheck commented May 18, 2021

Preflight Checklist

  • 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 a bug that matches the one I want to file, without success.

Issue Details

  • Electron Forge Version:
    • 6.0.0-beta.55
  • Electron Version:
    • 11.4.1
  • Operating System:
    • Windows 10
  • Last Known Working Electron Forge version::
    • 6.0.0-beta.54

Expected Behavior

Running the Electron app in dev mode should work.

Actual Behavior

When running electron-forge start it prints the following output:

√ Checking your system
√ Locating Application
√ Preparing native dependencies: 1 / 1
√ Compiling Main Process Code
× Launch Dev Servers

An unhandled error has occurred inside Forge:
Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'historyApiFallback'. These properties are valid:
   object { mimeTypes?, writeToDisk?, methods?, headers?, publicPath?, stats?, serverSideRender?, outputFileSystem?, index? }
ValidationError: Invalid options object. Dev Middleware has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'historyApiFallback'. These properties are valid:
   object { mimeTypes?, writeToDisk?, methods?, headers?, publicPath?, stats?, serverSideRender?, outputFileSystem?, index? }
    at validate (<project-path>\electron\node_modules\webpack-dev-middleware\node_modules\schema-utils\dist\validate.js:104:11)
    at wdm (<project-path>\electron\node_modules\webpack-dev-middleware\dist\index.js:29:29)
    at <project-path>\electron\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:292:22
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

I updated electron-forge from 6.0.0-beta.54 to 6.0.0-beta.55 and did not change any configuration.

To Reproduce

Additional Information

@atheck atheck added the bug label May 18, 2021
@jhofer
Copy link

jhofer commented May 18, 2021

I have the same issue when creating a new app using the webpack-typescript template:
https://www.electronforge.io/templates/typescript-+-webpack-template

@Xananax
Copy link

Xananax commented May 18, 2021

Edit the generated package.json and change the version of

"@electron-forge/plugin-webpack": "6.0.0-beta.54",

to .54 instead of .55.

I believe the faulty change is here: 790647d

@Meeshalk
Copy link

Meeshalk commented May 18, 2021

Got exactly same result after running npm update
Not only historyApiFallback but also logger and hot properties are seems to be not supported.

For a quick fix/temporary solution
Just follow @Xananax's answer and update your package.json file. Under devDependencies change the version for "@electron-forge/plugin-webpack": to 6.0.0-beta.54

Issue
The issue arises from here - L293 - L303

And commenting out below lines, fixes the issue, as webpack-dev-middleware introduced breaking changes

electron_forge_webpack_plugin_bug_002

I hope this may help someone to fix the issues. Maybe using infrastructurelogging weird console logs can be fixed, which I encountered after commenting the said lines.

electron_forge_webpack_plugin_bug_003

@malept
Copy link
Member

malept commented May 18, 2021

This will probably be fixed when I merge #2225

@electron electron locked and limited conversation to collaborators May 18, 2021
@malept
Copy link
Member

malept commented May 22, 2021

Fixed by #2225

@malept malept closed this as completed May 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants