4 ms·
Why doesn't NPM first check if the package is already installed locally?
And then a symlink or something of the sort could be created - or perhaps even a copy of the module in question. Why isn't this the way npm works?
If I initialize 10 different projects, and they all need React, I'd presumably do npm install react 10 distinct times. Which is fine, since each app is standalone - but why "waste" bandwidth by making separate requests for each one?
- MBCook 7y agoYarn’s PNP mode does this.
- photonios 7y agoNot sure about NPM, but Yarn, even v1 without PNP caches all packages and simply copies the package from the local cache into your `node_modules`. It doesn't do symlinks (PNP mode does) because this doesn't always work well and it definitely doesn't work well on Windows. See: https://classic.yarnpkg.com/en/docs/cli/cache/ https://classic.yarnpkg.com/en/docs/cli/cache/