yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

`yarn add` with package already installed removes the package #8061

Open remorses opened 4 years ago

remorses commented 4 years ago

when using workspaces

Bug description

yarn add with package already installed removes the package It happens when using the latest tag Command

yarn add recharts@latest
yarn add recharts@latest

then i won't find recharts in node_modules

Steps to Reproduce

  1. create some workspaces packages (not sure if happens without workspaces)
  2. install 2 times a package
  3. try import the package or check the root node_modules

Environment

lsliwaradioluz commented 9 months ago

I believe it also happens without the @latest tag. Also, I've noticed it happens for dependencies with ^ or ~ standing before the version number in package.json. For packages with a fixed version number, the problem does not occur.