【发布时间】:2018-05-22 03:56:17
【问题描述】:
我的 package.json(react-native@0.55.4 需要 react@16.3.1)
"dependencies": {
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.2",
"react-navigation": "^2.0.1"
}
我的 yarn.lock 文件中有重复的包。
react@16.3.1:
version "16.3.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.3.1.tgz#4a2da433d471251c69b6033ada30e2ed1202cfd8"
dependencies:
fbjs "^0.8.16"
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.0"
react@^16.0.0:
version "16.3.2"
resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9"
dependencies:
fbjs "^0.8.16"
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.0"
运行$ yarn remove react,结果。
react@^16.0.0:
version "16.3.2"
resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9"
dependencies:
fbjs "^0.8.16"
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.0"
如果我再次尝试运行它,我会得到error This module isn't specified in a manifest.
如何强制 yarn 移除所有 react 版本,以便我手动安装需要的版本?
yarn install 只需添加两个包。
yarn install --pure-lockfile 或 yarn install --frozen-lockfile 会解决这个问题吗?
【问题讨论】:
标签: package.json yarnpkg