Node.js 未找到模块:错误:Can';t解决';巴别塔装载机&x27;
我刚把我的web包从2.x升级到4.x。通过执行npm安装,我得到了以下错误Node.js 未找到模块:错误:Can';t解决';巴别塔装载机&x27;,node.js,reactjs,webpack,Node.js,Reactjs,Webpack,我刚把我的web包从2.x升级到4.x。通过执行npm安装,我得到了以下错误 Module not found: Error: Can't resolve 'babel-loader' 接下来,我在webpack.config.json中添加了以下行 resolveLoader: { root: path.join(__dirname, 'node_modules') } 但是我犯了以下错误 Invalid configuration object. Webpack has been
Module not found: Error: Can't resolve 'babel-loader'
接下来,我在webpack.config.json中添加了以下行
resolveLoader: { root: path.join(__dirname, '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? }
巴别塔加载器版本是7.1.4。网页包升级引入了此错误。有什么建议吗 你不安装这个“巴别塔加载器”吗
只需安装模块:
npm安装巴别塔加载器
或
纱线添加巴别塔加载器
我通过运行上述命令解决了此问题。您可以发布您的网页配置吗?我收到以下错误,模块解析失败:意外标记您可能需要适当的加载程序来处理此文件类型。
module: {
rules: [{
test: /\.jsx?$/,
include: [
path.resolve(__dirname, 'src/js'),
],
loader: "babel-loader",
options: {
presets: ["es2015"],
plugins: [
["babel-plugin-root-import", {
"rootPathSuffix": "src/js"
}],
[
"transform-runtime", {
"helpers": false,
"polyfill": false,
"regenerator": true,
"moduleName": "babel-runtime"
}
],
"transform-object-assign", "transform-function-bind"
]
},
// options for the loader
}}