无法parsing'babel-loader'

我正在尝试configuration我的第一个节点反应的应用程序。

我不断收到一个错误,说“无法parsingbabel-loader”。

用Googlesearch这个错误,我发现了一些不起作用的build议。

首先是将以下内容添加到我的webpack.config.js中

// resolveLoader: { // modulesDirectories: '/usr/local/lib/node_modules' // }, 

尝试产生一个错误,说:

 Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.resolveLoader has an unknown property 'modulesDirectories'. These properties are valid: object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? } 

下一个build议是尝试:

 resolveLoader: { fallback: '/usr/local/lib/node_modules' }, 

这产生了类似的错误。

有没有人有关于如何开始使用此configuration的任何build议。 理解文档非常困难 – 每隔一秒就是行话,我无法find一个参考点来find基本的了解需要做什么才能开始在这个设置。

Webpack.config.js是:

 module.exports = { entry: './app/app.jsx', output: { path: __dirname, filename: './public/bundle.js' }, resolve: { modules: [__dirname, 'node_modules'], alias: { Greeter: 'app/components/Greeter.jsx', GreeterMessage: 'app/components/GreeterMessage.jsx', GreeterForm: 'app/components/GreeterForm.jsx', }, extensions: ['.js', '.jsx'] }, // resolveLoader: { // fallback: '/usr/local/lib/node_modules' // }, module :{ rules:[{ // use : 'babel-loader', loader: 'babel-loader', query :{ presets:['react','es2015'] // ,'es2017' }, test: /\.jsx?$/, exclude: /(node_modules|bower_components)/ } ] } }; 

我有同样的问题; 我通过安装babel-loader模块来修复它:

yarn add babel-loader

要么

npm install babel-loader