简单反应应用程序中的配置对象错误无效

时间:2017-08-23 07:19:53

标签: reactjs

我写了一个简单的" Hello World" ReactJS中的代码,但这是抛出错误。请告诉我们可能出现什么问题?

错误:

submit button

webpack.config.js 文件

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! reactRouting@1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactRouting@1.0.0 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

1 个答案:

答案 0 :(得分:0)

我强烈建议你使用npm的路径,如下所示,

const path = require('path');

,您的输出应该变为

output: {
   path: path.resolve(__dirname, 'app'),
    filename: 'bundle.js',
    publicPath: '/'
},

这将解决您的问题。