Fixing My Reoccuring Yarn Event Stream ErrorFebruary 9, 2019
Recently I encountered a repeated error trying to globally install command line programs with Yarn. No matter what I did it didn’t seem to matter, the error would return. Today - I finally cracked the puzzle.
> yarn global add @feathers-plus/cli yarn global v1.13.0 [1/4] Resolving packages... [2/4] Fetching packages... error An unexpected error occurred: "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.6.tgz: Request failed \"404 Not Found\"". info If you think this is a bug, please open a bug report with the information provided in "/home/arran/.config/yarn/global/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
A quick Google didn’t turn up anything too helpful event-stream was the recent victim of a social engineering attack and version 3.3.6 was pulled from NPM however the package I was trying to install didn’t depend on the vulnerable version.
It took me a while to track down the cause of the issue but it relates to the way Yarn caches packages. Yarn had spotted that
email@example.com existed and cached it however when the package was pulled it was no longer able to be downloaded causing the error.
In the end all I had to do was track down the
yarn.lock file (mine was stored in
~/.config/yarn/global), delete it, and then retry the install.