0
votes

Here is how you update your webpack-cli for anyone else who was curious. This issue arose when I was creating a new JHipster project, and was having issues with npm start.

First, check your version of webpack by running this command in the terminal of your IDE: webpack --version. You should see a list that appears like this:

enter image description here

If your "webpack-cli" reads anything below 4.10.0, then you need to update it to the latest version for npm to run properly on your localhost with JHipster. Here's how to update it.

Run this command in the terminal of your IDE: npm install [email protected]

[Right now, the latest version is 4.10.0, but for the future updates when you run this command, change the version at the end of the command line to updated to that current version. Example: npm install webpack-cli@(INSERT NEW VERSION DIGITS HERE).

Then re-run webpack --version, and see if your webpack has updated to the version that you entered above. It should now look like this:

enter image description here


EXTRA NOTES:

Why did you have this error? According to webpack.js.org: "...Installing globally locks you down to a specific version of webpack and could fail in projects that use a different version."

So, if you ran a command like this: "npm install --global webpack", then there is a good chance that you were locked down to a specific version. This might have been the error. That's what I believe happened to me anyway. I ran npm install -g, or something of that nature. Simply us the terminal command npm install [email protected] in your IDE's terminal to update it, and you should be good to go! :)

Sources for your journey and research that relate to the material above:

https://webpack.js.org/guides/installation/

https://stackabuse.com/npm-install-specific-version-of-a-package/

If this was supposed to be a self-answered question, note it must still be a separate question and answer meeting the usual quality standards.jonrsharpe