I’ve run into similar issues before, some package update that broke everything, only to get pulled/patched a few hours later.
I’ve run into similar issues before, some package update that broke everything, only to get pulled/patched a few hours later.
Especially after the fakerjs (and other) things.
Many of those supply chain attacks are detected within the first few hours, I guess nowadays there are even some companies out there, that run automated analysis on every new version of major packages. Also contributors/maintainers might notice something like that quickly, if they didn't plan that release and it suddenly appears.
So while your package manager will install whatever is newest, there are free solutions to keep your dependencies up to date in a reasonable manner.
Also, the javascript ecosystem seems to slowly be going in the direction of consolidation, and supply chain attacks are (again, slowly) getting tools to get addressed.
Additionally, current versions of all major package managers (NPM, PNPM, Bun, I don't know about Yarn) don't automatically run postinstall scripts - although you are likely to run them anyway because they will be suggested to you - and ultimately you're running someone else's code, postinstall scripts or not.
What this means is that you can run "npm instal --before (date for 2 days ago)" and it will skip any dependencies newer than that.