3 ms·
my big gripe with npm is that the global packages overshadow the local packages... I can't understand when that would be a good option other than maybe having a
by weaksauce 4y ago
my big gripe with npm is that the global packages overshadow the local packages... I can't understand when that would be a good option other than maybe having an option to do so but not being the default. I can't think of another package manager that does this.
oh that and installing thousands of packages in the project root instead of a sensible place that could be shared per version like bundler and rubygems.
- GauntletWizard 4y agoYou can't do a package cache, because nasal demons erupt whenever you use a package that's not precisely equal and all packages use their own copies of all their dependencies. Sane package managers don't try to solve for this problem; they make it clear when you're using bad software.
- weaksauce 4y agoBundler does this just fine. installs every single exact dependency in a central location and then sets the relevant paths to them before running ruby. It works very well. some of the people behind bundler wrote the much loved package manager for rust. I'm not sure where you are getting the thought that other systems haven't done it better.
- GauntletWizard 4y agoThat's exactly the behavior that makes NodeJS unsuitable as a package manager. Some resources are, in fact, globals. You should have a consistent enough API to use those through code that is imported and singular, rather than through importing a dozen versions of the API for each dependency you have.
- andrew_ 4y agoThe globally installed packages only take precedence over local packages when you run the binary name from the command line. To get that to stop, you'd have to add the local node_modules/.bin to the PATH. Additionally, if you run npx/yarn/pnpx in a package script, it will use the local binary. > oh that and installing thousands of packages in the project root instead of a sensible place that could be shared per version like bundler and rubygems. Look into pnpm. It does precisely this in a way that's compatible with node. Honestly the information is out there to address most people's gripes.
- chakkepolja 4y ago> Honestly the information is out there to address most people's gripes. Exactly, but not discoverable. I came to know of esbuild, vite, pnpm etc.. only because of reddit and HN.
- andrew_ 4y agoYou discovered it because of reddit and HN. Others have dev.to, SO, Twitter, etc. Most devs today have to be mobile and inquisitive. It's not really a field for the complacent.