0
我在ReactJS中写了一个简单的“Hello World”代码,但是这是抛出错误。请告诉可能是什么问题?简单的反应应用程序中的配置对象错误无效
错误:
Invalid configuration object. Webpack has been initialised using a configuration
object that does not match the API schema.
- configuration.output.path: The provided value "./app" is not an absolute path
!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache\_logs\2017-08-23T07_10
_18_206Z-debug.log
webpack.config.js文件
module.exports = {
entry: './app/main.js',
output: {
path: './app',
filename: 'bundle.js'
},
devServer: {
inline: true,
contentBase: './app',
port: 8080
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
}
]
}
}
不要忘记做** NPM安装路径** –
现在服务器已启动,但仍然我得到这个错误: '多(的WebPack)错误-dev服务器/客户端的http:// localhost:8080 ./app/main.js 未找到模块:错误:无法解析'C:\ Users \用户名\ Desktop \ actRouting'中的'babel' 断开更改:不再允许省略'-loader'后缀使用 装载机。 您需要指定'babel-loader'而不是'babel', 请参阅https://webpack.js.org/guides/migrating/#automatic-loader-m 模块名称扩展名删除 @ multi( webpack)-dev-server/client?http:// localhost:8080。/ app/main.js' – Agha
使用'loader:[ test:/\.js$/, exclude:/ node_modules /, 装载机:'babel-loader' } ]' –