Do you want to request a feature or report a bug?
Bug report.
What is the current behavior?
My build scripts started failing after a recent yarn install
and I noticed that certain packages were completely missing from the node_modules folder, yet are listed in yarn.lock
, as seen here: https://github.com/milesj/boost/blob/master/yarn.lock#L35
@beemo/driver-babel
and @beemo/driver-jest
are entirely missing.
Running yarn cache clean
and rm -rf node_modules
did not resolve this issue.
If the current behavior is a bug, please provide the steps to reproduce.
- Clone the repo
yarn install
yarn test
What is the expected behavior?
Node modules are installed.
Please mention your node.js, yarn and operating system version.
Node v10.0.0
Yarn v1.6.0
OSX v10.13.4
That doesn’t matter. If you depend on something, you must specify it into your dependencies. The reason it was working before is that Yarn was optimizing your tree to make the node_modules smaller, and that the Node resolution isn’t able to prevent you from using packages optimized this way even if it should.
Then you upgraded
@rails/webpacker
, the optimization wasn’t possible anymore without doing many other changes to your lockfile, so Yarn putbabel-loader
into@rails/webpack/node_modules/babel-loader
, where you couldn’t access it. And finally when you deleted the lockfile, Yarn reoptimized everything without regard for the dependencies already installed, andnode_modules/babel-loader
was made available again.Relying on this is entirely undefined behavior, do not do it. Always list your dependencies explicitely. Note that this isn’t unique to Yarn, the same is true for npm. And pnpm will break your application entirely.