首页 > 解决方案 > 无法解决 @babel 解决问题 Yarn/Rails

问题描述

babel 有一个解决方案

"resolutions": {
"babel-plugin-dynamic-import-node": "2.3.0"
},

我知道这是为了解决一个错误,如果你使用更高的东西,一切都会中断。

现在的问题是,当我尝试通过在合并之前检查所有内容的系统运行它时,此错误会阻止它通过:

警告解决字段“babel-plugin-dynamic-import-node@2.3.0”与请求的版本“babel-plugin-dynamic-import-node@^2.3.3”不兼容

在依赖项下的 package.json 文件中,它列出了:

"babel-plugin-dynamic-import-node": "2.3.0",

我可以在 yarn.lock 文件中看到 3 个对 v2.3.3 的引用。

"@babel/plugin-transform-modules-amd@^7.14.5":
  version "7.14.5"
  resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.14.5.tgz#4fd9ce7e3411cb8b83848480b7041d83004858f7"
  integrity sha512-xxx
  dependencies:
    "@babel/helper-module-transforms" "^7.14.5"
    "@babel/helper-plugin-utils" "^7.14.5"
    babel-plugin-dynamic-import-node "^2.3.3"

"@babel/plugin-transform-modules-commonjs@^7.14.5":
  version "7.14.5"
  resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.14.5.tgz#7aaee0ea98283de94da98b28f8c35701429dad97"
  integrity sha512-xxx
  dependencies:
    "@babel/helper-module-transforms" "^7.14.5"
    "@babel/helper-plugin-utils" "^7.14.5"
    "@babel/helper-simple-access" "^7.14.5"
    babel-plugin-dynamic-import-node "^2.3.3"

"@babel/plugin-transform-modules-systemjs@^7.14.5":
  version "7.14.5"
  resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.14.5.tgz#c75342ef8b30dcde4295d3401aae24e65638ed29"
  integrity sha512-xxx
  dependencies:
    "@babel/helper-hoist-variables" "^7.14.5"
    "@babel/helper-module-transforms" "^7.14.5"
    "@babel/helper-plugin-utils" "^7.14.5"
    "@babel/helper-validator-identifier" "^7.14.5"
    babel-plugin-dynamic-import-node "^2.3.3"

但是,如果不手动编辑锁定文件,我无法让它们降级到 v2.3.0,这是可以理解的,它不起作用并导致其他问题。

我尝试删除 yarn.lock 文件并运行 yarn install,它只是再次创建分辨率并再次创建这 3 个引用。

我试着跑步

yarn upgrade babel-plugin-dynamic-import-node@2.3.0  

但这不会改变锁定文件中对这 3 个项目的引用。

这也在 yarn.lock 文件中:

    babel-plugin-dynamic-import-node@2.3.0, babel-plugin-dynamic-import-node@^2.3.3:
  version "2.3.0"
  resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f"
  integrity sha512-xxx
  dependencies:
    object.assign "^4.1.0"

标签: ruby-on-railslinuxyarnpkgpackage.json

解决方案


推荐阅读