webpack-dev-server返回“配置有未知属性'错误'”

时间:2017-10-01 20:18:52

标签: webpack webpack-dev-server

我安装了webpack ^ 3.0.0和webpack-dev-server ^ 2.9.1(在项目和全局范围内)。 在项目根目录中运行{ "_id" : ObjectId("59d128805b19310ac8ab3fc2"), "categories" : [ { "k" : "Location" }, { "k" : "DeviceType" }, { "k" : "Style" }, { "k" : "Color" } ] } 后,出现错误

webpack-dev-server

projet根目录下的webpack.config.js文件包含以下内容:

Invalid configuration object. webpack-dev-server has been initialised 
using a configuration object that does not match the API schema.
 - configuration has an unknown property 'error'. These properties are 
valid:
object { hot?, hotOnly?, lazy?, bonjour?, host?, allowedHosts?, 
filename?, publicPath?, port?, socket?, watchOptions?, headers?, 
clientLogLevel?, overlay?, progress?, key?, cert?, ca?, pfx?, 
pfxPassphrase?, requestCert?, inline?, disableHostCheck?, public?, 
https?, contentBase?, watchContentBase?, open?, useLocalIp?, openPage?, 
features?, compress?, proxy?, historyApiFallback?, staticOptions?, 
setup?, before?, after?, stats?, reporter?, noInfo?, quiet?, 
serverSideRender?, index?, log?, warn? }

我已尝试按照this SO question中的建议,但无济于事。如何启动webpack?

我还注意到,当我在全局安装webpack-dev-server ^ 2.9.1时,它拒绝承认webpack ^ 3.0.0的同行,尽管它存在。这有关系吗?

2 个答案:

答案 0 :(得分:3)

问题与问题末尾提到的全球安装有关。从项目根目录运行webpack-dev-server似乎导致项目安装和全局安装开始运行,因此它们存在相互的端口冲突。其中一个人在检测到这个冲突时抛出了一个错误,另一个人发现这个错误,认为这是额外的配置输入。

使用webpack-dev-server的项目安装解决了这个问题。

答案 1 :(得分:1)

解决了webpack-sev-server版本2.9.3(全局/本地实例冲突)。

关闭github问题:https://github.com/webpack/webpack-dev-server/issues/1142