Borzi
Borzi

Reputation: 577

Getting "Unknown Option" error running JHipster generated frontend with "npm start"

Whenever I run my default JHipster project (I only changed some code on the backend and made a few styling changes), I get the following error:

[webpack-cli] Error: Unknown option '--inline' [webpack-cli] Run 'webpack --help' to see available commands and options

Already ran sudo npm i -S webpack@latest to ensure I'm using a new webpack version.

If I remove --inline from the commands, I get a different error:

1% setup initialize[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. options has an unknown property 'watchOptions'. These properties are valid: object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, setupExitSignals?, static?, watchFiles?, webSocketServer? }

Little bit confused here as I haven't setup the project and also not touched webpack in a while - appreciate any help and thanks in advance!

Upvotes: 1

Views: 870

Answers (1)

Borzi
Borzi

Reputation: 577

It was simply a version dependency mismatch. For some reason, the Webpack Config was not defined for the same version as the as the one installed (v4 vs v5 respectively) - I simply assumed that the package json settings would prevent this from happening. I went through each error using the webpack docs and upgraded it according to the migration instructions.

Upvotes: 1

Related Questions