Having a little trouble with React. Does anyone know how I can install the peer of webpack@^4.x.x?
This is the error I am recieving when I try to run
webpack-dev-server
in cmd. It just returns
[email protected] requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.
If you're using webpack v4 or later and want to call webpack from the command line, you'll also need to install the CLI.
webpack CLI provides a flexible set of commands for developers to increase speed when setting up a custom webpack project. As of webpack v4, webpack is not expecting a configuration file, but often developers want to create a more custom webpack configuration based on their use-cases and needs.
This approach considers that since your production app (aka the bundle you built with Webpack) can just run by itself, it means you have no production dependencies. Thus, all dependencies are devDependencies .
npm WARN [email protected] requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.
Installing locally is what we recommend for most projects. This makes it easier to upgrade projects individually when breaking changes are introduced. Typically webpack is run via one or more npm scripts which will look for a webpack installation in your local node_modules directory:
webpack CLI is a CLI tool for providing a flexible set of commands for developers to increase speed when setting up a custom webpack project. As of webpack v4, webpack is not expecting a configuration file but often, developers want to create a more custom webpack configuration based on their use-cases and needs.
If you are enthusiastic about using the latest that webpack has to offer, you can install beta versions or even directly from the webpack repository using the following commands: npm install --save-dev webpack@next npm install --save-dev webpack/webpack Take caution when installing these bleeding edge releases!
webpack-dev-server
has Webpack as a peer dependency, which means that you are responsible for installing that yourself.
You could install the latest version of Webpack and add it to your devDependencies
with the following command:
npm i -D webpack@latest
By writing webpack-dev-server
you are also trying to use the globally installed version of that package. You can use the locally installed one instead by adding it to a script in your package.json
:
{
"scripts" : {
"start": "webpack-dev-server"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With