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.46k stars 2.73k forks source link

Yarn will remove packages another packages depend on #6737

Open jasonxia23 opened 6 years ago

jasonxia23 commented 6 years ago

Do you want to request a feature or report a bug?

A bug.

What is the current behavior? Yarn will remove the @babel/plugin-syntax-jsx in node_modules even if another package depend on this package.

cat node_modules/@babel/plugin-syntax-jsx

cat: node_modules/@babel/plugin-syntax-jsx: Is a directory

npm ls @babel/plugin-syntax-jsx

├─┬ @svgr/webpack@2.4.1 │ └─┬ @babel/preset-react@7.0.0 │ ├─┬ @babel/plugin-transform-react-jsx@7.1.6 │ │ └── @babel/plugin-syntax-jsx@7.0.0 │ ├─┬ @babel/plugin-transform-react-jsx-self@7.0.0 │ │ └── @babel/plugin-syntax-jsx@7.0.0 deduped │ └─┬ @babel/plugin-transform-react-jsx-source@7.0.0 │ └── @babel/plugin-syntax-jsx@7.0.0 deduped └─┬ babel-preset-react-app@6.1.0 └─┬ @babel/preset-react@7.0.0 ├─┬ @babel/plugin-transform-react-jsx@7.0.0 │ └── @babel/plugin-syntax-jsx@7.0.0 ├─┬ @babel/plugin-transform-react-jsx-self@7.0.0 │ └── @babel/plugin-syntax-jsx@7.0.0 deduped └─┬ @babel/plugin-transform-react-jsx-source@7.0.0 └── @babel/plugin-syntax-jsx@7.0.0 deduped

If the current behavior is a bug, please provide the steps to reproduce.

npx create-react-app <project-name>
cd <project-name>
yarn eject
yarn

cat node_modules/@babel/plugin-syntax-jsx
# cat: node_modules/@babel/plugin-syntax-jsx: Is a directory

What is the expected behavior? After running yarn install, @babel/plugin-syntax-jsx should be in node_modules

Please mention your node.js, yarn and operating system version. Node v8.11.3 Npx v6.4.1 Yarn v1.12.3 Npm v6.4.1 System MacOS 10.13.4

arcanis commented 6 years ago

cat: node_modules/@babel/plugin-syntax-jsx: Is a directory

This message makes quite clear that the directory, in fact, exists? Or am I missing something? ...

jasonxia23 commented 6 years ago

My fault.

cat: node_modules/@babel/plugin-syntax-jsx: Is a directory

is after I install by yarn add --dev @babel/plugin-syntax-jsx