我有一个webpack.config.js
这样的文件:
var path = require('path')
var webpack = require('webpack');
module.exports = {
entry: "./index.js",
output: {
path: path.join(__dirname, 'static'),
filename:'bundle.js'
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"},
{ test: /\.json$/, loader: 'json-loader' },
]
}
};
和我的package.json
就像:
"scripts": {
"test": "mocha --compilers js:babel-register --recursive tests/*.js",
"test:watch": "npm test -- --watch",
"build": "webpack --progress --profile --colors",
"build:watch": "webpack --progress --profile --colors --watch",
"start": "webpack-dev-server"
但是当我运行npm run start
时,它会给我错误的说法..
events.js:141
throw er; // Unhandled 'error' event
这里有什么问题?
答案 0 :(得分:1)
启动webpack dev服务器时可能是“端口”问题。试试webpack-dev-server --port 3000