因为重装系统,重新安装了node,原来一切正常的webpack打包项目,现在出现了如下错误:
E:aa>webpack-dev-server
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?, stats?, reporter?, noInfo?, quiet?, serverSideRender?, index?, log?, warn? };
半个月没去运行这个项目,今天运行了一下,竟然恢复正常了,没有任何设置,一切正常,原来时间才是最好的解药
排查了3个小时,发现自己新安装的node版本过低,4.4.3,最新已经6.多了。卸载之后重新安装,原先在npm install时抛出的警告都没了,可是运行webpack-dev-server还是出现同样的错误,最后我试了试把config里devServer全部注释掉,重新运行webpack-dev-server,奇迹出现了,竟然跑了起来,端口号还是被注释掉的8181;虽然问题解决了,但是我非常奇怪,为什么devServer里的配置都注释了,webpack-dev-server能运行成功,而且端口号还是有效的,我在其他文件查找也没有找到其他有配置端口的字段。