如何安装webpack-dev-server?获得未满足的依赖项

时间:2016-10-08 00:15:14

标签: npm webpack

我用过:

npm install -g webpack
npm install -g webpack-dev-server

我一直在:

├── UNMET PEER DEPENDENCY webpack@>=1.3.0 <3
└─┬ webpack-dev-server@1.16.2 
  └── UNMET PEER DEPENDENCY webpack@1 || ^2.1.0-beta

然后我尝试了:

npm install webpack@2.1.0-beta.25 -g

尝试npm install webpack-dev-server仍会产生相同的错误。是什么给了什么?

2 个答案:

答案 0 :(得分:12)

npm install --save-dev webpack
npm install --save-dev webpack-dev-server

尝试这些命令......它对我有用......

答案 1 :(得分:0)

本文也可能有所帮助:

http://ia.njamieson.co.uk/2017/01/21/a-very-simple-guide-setting-up-webpack-dev-server-on-a-mac-using-terminal/

npm install --save-dev webpack webpack-dev-server 

假设您的文件位于src文件夹中,请运行您的webpack-dev服务器:

webpack-dev-server --content-base=src