Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is one of if not the most insane thing in web dev at the moment. Git can diff thousand of files between two commit in less time than it takes to render the result on screen. But somehow it can take actual minutes to find out where to place a dependency in a simple tree with npm. God, why ?


> it can take actual minutes to find out where to place a dependency in a simple tree with npm. God, why ?

npm is famous for a lot of things & reasons, but none of those are "because it's well engineered".

To this day, npm still runs the `preinstall` script after dependencies have actually been downloaded to your disk. It modifies a `yarn.lock` file if you have it on disk when running `npm install`. Lots of things like these, so that the install is slow, is hardly surprising.


Since when would npm install modify a yarn lock file?



I don't know exactly the "since when", but recently I was caught off guard when issuing `npm i` by mistake in a yarn project. It modifies "yarn.lock" by changing some, if not all, the registry from yarn pkg registry to npm package registry.


People building language tooling often use the language itself, even if it is not very suitable for the task at hand.

This happens because the tooling often requires domain knowledge which they have and if they set out to write tooling for a language they tend to be experienced in that language.


JS definitely doesn’t help, but it is a surprisingly fast language with modern runtimes. The problem lies elsewhere.


In fairness, I suspect your average node_modules folder has a lot more files than your average git repo (maybe even an order of magnitude more)


> it can take actual minutes to find out where to place a dependency in a simple tree with npm. God, why ?

Is it even a tree? Does NPM still allow circular dependencies?


But who still uses npm for that, and for what reason? Yarn seems much faster.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: