在Windows 10中运行注释“npm start”时出错。
的package.json
Log
webpack-dev-server --hot
webpack-dev-server --hot
webpack.config.js
var config = {
entry: './main.js',
output: {
path:'./',
filename: 'index.js',
},
devServer: {
inline: true,
port: 8080
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
}
}
答案 0 :(得分:0)
尝试输入npm run start
alt npm r start
导航到package.json所在的同一文件夹
键入npm install
以获取所有依赖项。
输入npm run start
你有webpack.config.js
吗?
可能是格式错误的webpack配置:这是我的外观,(替换你的东西):
var path = require('path');
module.exports = {
context: path.resolve('src/main'),
entry: {
myapp: './dependencies.js',
},
output: {
path: path.resolve('build/dev'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /.(png|jpg|jpeg|gif|svg|woff|woff2|eot|ttf)(.*)$/,
loader: 'url-loader?limit=100000'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
}
]
}
};
答案 1 :(得分:0)
您的 webpack.config.js 文件有问题。您需要像这样导出配置对象-
module.exports = {
entry: './main.js',
output: {
path:'./',
filename: 'index.js',
},
devServer: {
inline: true,
port: 8080
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
}
}