【问题标题】:Installing a specific version of a package with yarn doesn't work使用 yarn 安装特定版本的包不起作用
【发布时间】:2021-07-31 05:44:10
【问题描述】:

我在 React 应用程序中使用 framer-motion。最新版本 - 4.1.13 - 打破了我的用户界面。我需要降级到以前的版本 - 4.1.2 -(是的,版本控制看起来很奇怪,但 4.1.2 实际上早于 4.1.13,请参阅https://www.npmjs.com/package/framer-motion)。

我运行命令yarn upgrade framer-motion@^4.1.2。在package.json,包变成4.1.2,但是在yarn.lock,包的版本还是4.1.13

framer-motion@^4.1.2:
  version "4.1.13"
  resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-4.1.13.tgz#0a7f096113a0f80f11116c1a73da9b81523324cd"
  integrity sha512-E72PyzHXsie1IGcEFMGM3OJsVbtmpS8vcnDjh6tdeCaP7stoioZpmKZcx7c87giymAyuSSWvsGGdVnDGRzRX6g==
  dependencies:
    framesync "5.3.0"
    hey-listen "^1.0.8"
    popmotion "9.3.5"
    style-value-types "4.1.4"
    tslib "^2.1.0"
  optionalDependencies:
    "@emotion/is-prop-valid" "^0.8.2"

我当然做过rm -rf node_modules && yarn。它不会改变任何东西。

【问题讨论】:

  • 也许你应该试试yarn upgrade framer-motion@4.1.2?添加^ 允许错误发布升级。
  • 有效!谢谢!

标签: reactjs npm yarnpkg package.json framer-motion


【解决方案1】:

您运行的命令:yarn upgrade framer-motion@^4.1.2 允许以下范围内的任何版本:

>=4.1.2 <5.0.0

4.1.13 在这个范围内,所以纱线可能是最新的。运行yarn upgrade framer-motion@4.1.2安装具体版本。


如果它不起作用,作为最后的手段尝试添加:

"resolutions":
   "framer-motion": "4.1.2"
}

【讨论】:

    猜你喜欢
    • 2019-01-22
    • 1970-01-01
    • 2022-08-18
    • 2021-09-16
    • 2017-04-16
    • 2016-09-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多