Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not remove global bin/man links inappropriately
Prevent a global install from overwriting bins and manpages if they are not links/shims that npm controls, or if then are links/shims to packages other than the one being installed. Changes error message output on EEXIST errors to be more helpful. Related: - npm/bin-links#12 - npm/gentle-fs#7 Note: this does NOT prevent packages from overwriting one another's bins in non-global package installs, because doing so would introduce a [dependency hell](https://en.wikipedia.org/wiki/Dependency_hell) that npm 6 is not capable of avoiding without significant refactoring. The collision detection in npm v7's tree building will enable us to explore such an option, by never placing dependencies in the same place if they would write the same bin script. (It's fundamentally similar to peerDependency resolution, but much simpler.) Since users have not complained about this potential foot-gun in the last 5 years, its unlikely that it is a significant issue, and introducing additional dependency nesting (or worse, failing installs for unresolveable trees) is likely an even worse hazard. If we do prevent non-global-top installs from overwriting one another's bins, it ought to be done only as best-effort (ie, allow the collision if both deps need to be placed in the same node_modules folder) and perhaps opt-in with a config flag.
- Loading branch information