admin管理员组

文章数量:1200965

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.

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.
Share Improve this question asked Jul 11, 2018 at 20:36 AllanAllan 3511 gold badge2 silver badges11 bronze badges 0
Add a comment  | 

2 Answers 2

Reset to default 16

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 need webpack updated globally to the latest version, you can run:

npm install -g webpack

本文标签: javascriptwebpackcli308 requires a peer of webpack4xx but none is installedStack Overflow