2017-09-19 7 views
1

私はwebpack-dev-serverを実行しようとしていますし、それは私に次のエラーを与えている:のWebPACK-devのサーバーに無効な構成オブジェクト

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? } 

私はそれはそれをやっている理由は全くわかりません。 webpackは正常に動作しますが、問題があるかどうかはわかりません。

はここにある私のpackage.json

{ 
    "name": "monettapage", 
    "version": "1.0.0", 
    "description": "Monetta Landing Page", 
    "main": "webpack.config.js", 
    "dependencies": { 
    "babel-core": "^6.25.0", 
    "babel-loader": "^7.1.1", 
    "babel-preset-es2015": "^6.24.1", 
    "babel-preset-react": "^6.24.1", 
    "css-loader": "^0.28.4", 
    "file-loader": "^0.11.2", 
    "html-webpack-plugin": "^2.29.0", 
    "material-shadows": "^3.0.1", 
    "material-ui": "^0.18.6", 
    "material-ui-chip-input": "^0.15.3", 
    "node-sass": "^4.5.3", 
    "npm": "^5.4.2", 
    "react": "^15.6.1", 
    "react-dom": "^15.6.1", 
    "react-router": "^4.1.1", 
    "react-router-dom": "^4.1.1", 
    "react-speech": "^0.3.2", 
    "react-tap-event-plugin": "^2.0.1", 
    "react-time": "^4.3.0", 
    "react-voice-components": "^1.0.0", 
    "sass-loader": "^6.0.6", 
    "style-loader": "^0.18.2", 
    "webpack": "^3.0.0", 
    "webpack-dev-server": "^2.5.0" 
}, 
    "scripts": {}, 
    "repository": { 
    "type": "git", 
    "url": "git+https://github.com/MonettaTech/monettapage.git" 
    }, 
    "engines": { 
    "node": "8.0.0", 
    "npm": "5.0.3" 
    }, 
    "author": "TDe", 
    "license": "UNLICENSED", 
    "bugs": { 
    "url": "https://github.com/MonettaTech/monettapage/issues" 
    }, 
    "homepage": "https://github.com/MonettaTech/monettapage#readme" 
} 

と私のwebpack.config.js

const path = require('path'); 
const webpack = require('webpack'); 
const HtmlWebpackPlugin = require('html-webpack-plugin'); 

const config = { 
    entry: [ 
     './app/routes/routes.js' 
    ], 
    output: { 
     path: path.resolve(__dirname,"docs"), 
     filename: "index_bundle.js", 
     publicPath: "" 
    }, 
    module: { 
     loaders: [ 
      {test: /\.jsx?$/, use: {loader:'babel-loader', options:{presets: ["react","es2015"], plugins: ["transform-es2015-arrow-functions"]}}, exclude: [/node_modules/,/dist/,/test/]}, 
      {test: /\.css$/, use:['style-loader','css-loader']}, 
      {test: /\.(scss|sass)$/, use: ['style-loader', 'css-loader','sass-loader']}, 
      {test: /\.(woff2?|jpe?g|png|gif|ico)$/, use: 'file-loader?name=./assets/images/[name].[ext]' }, 
      {test: /\.(eot|svg|ttf|woff|woff2)$/, use: 'file-loader?name=./assets/fonts/[name].[ext]' } 
     ] 
    }, 
    plugins: [ 
     new HtmlWebpackPlugin({ 
      template: './app/index.html', 
      filename: 'index.html', 
      inject: 'body' 
     }) 
    ], 
    devServer: { 
     port: 6969, 
     historyApiFallback: true 
    } 
}; 

module.exports = config; 

私はこの問題を回避するために働く答えを見つけることができます。面白いのは、昨日はうまくいっていて、今日は一度も働いていないということです。

npm install -g npmを実行してnpmを更新すると、npm install -g webpack webpack-dev-servernpm updateとなり、問題は解決しません。

+0

解決方法を見つけましたか? – FrankerZ

答えて

0

最近、同様の問題が発生しました。webpack-dev-serverのバージョンを確認してください。 V2.8.0 +が原因の可能性があります。私は2.7.1(固定)に私のダウングレードし、問題は何とか解決されます。

関連する問題