Yarn installing multiple versions of the same package

You need to use Yarn resolutions for this

https://yarnpkg.com/lang/en/docs/selective-version-resolutions/

So your package.json will become like this

{
  "name": "depdencies",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",

    "dependencies": {
        "angular": "1.5.11",
        "angular-foundation": "0.7.0"
    },
    "resolutions": {
      "**/angular": "1.5.11"
    }
}

Which tells yarn that any child angular dependency will be set to 1.5.11. After updating this run below

$ rm yarn.lock
$ yarn

https://classic.yarnpkg.com/en/docs/cli/add/#toc-yarn-add-alias

yarn add <alias-package>@npm:<package>

yarn add react17@npm:react@17

Tags:

Npm

Yarnpkg