使用纱线安装特定版本的软件包不起作用

Don*_*al0 3 npm reactjs package.json yarnpkg framer-motion

我在 React 应用程序中使用框架运动。最新版本 - 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"
Run Code Online (Sandbox Code Playgroud)

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

T J*_*T J 5

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

>=4.1.2 <5.0.0
Run Code Online (Sandbox Code Playgroud)

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


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

"resolutions":
   "framer-motion": "4.1.2"
}
Run Code Online (Sandbox Code Playgroud)