Hacker News new | ask | show | jobs
by rhacker 2947 days ago
I love npm, but there's some bug that keeps looming. I have a git based dependency (basically a dependency that's attached to https://user:password@gitlab.com/xxxxxx#branch)

I don't know why, but any time I install something specific in this project:

npm i -D @types/tacos

(for example)

The last line of npm says this: added 9 packages and removed 15 packages in 9.69s

Those 15 removed packages? Not dependency conflicts, no, thats the git dependency and all of its sub-dependencies.

So my workflow is now:

npm i --save <whatever>

npm i

3 comments

I worked with @iarna over at npm to get a very similar bug fixed - https://github.com/npm/npm/pull/20198. I'm pretty sure this is just a special case of that bug - if you're not on npm 6.1.0 it might be fixed there. Otherwise I'd encourage you to comment in on that PR / the attached issue with a flow to reproduce.
Excellent news. Is this fix likely to fix prune by chance as well?

(That's been bloating my Electron packages for a bit in that I haven't been able to trust prune --dev not to prune dependencies of a git package.)

I had this issue as well. I found an outstanding issue [0] on github. Running npm install -g npm will update your npm to the absolute latest version, which resolves this erroneous removal.

[0] : https://github.com/npm/npm/issues/17379

npm fixed a lot of the git dependency issues with 5.7.1. Have you tried updating?