5

My package.json (react-native@0.55.4 requires react@16.3.1)

  "dependencies": {
    "expo": "^27.0.1",
    "react": "16.3.1",
    "react-native": "~0.55.2",
    "react-navigation": "^2.0.1"
  }

I am getting duplicate packages in my yarn.lock file.

 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"

Running $ yarn remove react, results in.

 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"

If I try to run it again, I get error This module isn't specified in a manifest.

How do force yarn to remove all react versions, so that I can manually install the version I need?

yarn install simply add both packages.

Will yarn install --pure-lockfile or yarn install --frozen-lockfile resolve this?

tk421
  • 5,775
  • 6
  • 23
  • 34
redstubble
  • 121
  • 2
  • 12

1 Answers1

2

So from research (https://github.com/yarnpkg/yarn/issues/4379)

Frozen-lockfile since it will fail only if your lock file needs changing and is not consistent. Pure-lockfile you may have a lockfile close to being useless or very inaccurate but you still wouldn't get a failure. Yarn would simply use the internal resolutions it calculated happily.

Ultimately I resolve duplicate packages How do I override nested dependencies with `yarn`?. Using resolutions in the package.json

"resolutions": { "react": "16.3.1" }

redstubble
  • 121
  • 2
  • 12