On Windows NPM has issues due to its deep nesting of dependencies. In order to fix this a friend suggested the following command
npm install <dep> -g --no-bin-link
The man pages say about this command
The --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain."
Could anyone explain, in plain language, what the impact this flag has on allowing dependencies to be installed that would usually causing deep path issues?
Could anyone explain, in plain language, what the impact this flag has on allowing dependencies to be installed that would usually causing deep path issues?
Sure. Many packages published on npm
can be used both as a command-line tool and programmatically. For example the jslint
package publishes both a command-line tool for linting files and an API that can be require
d, so you can write code that uses jslint
The deep path issues usually become visible when creating the files that go into the bin
directory, for command-line use. The deep paths usually do not affect packages used programmatically with require
.
So for "regular" dependencies of a package, it is usually harmless to omit the bin links, because those dependencies are consumed with require
.
For "dev" dependencies or packages installed globally, it is usually necessary to keep the bin links, because those packages are more likely to be used as command-line tools.
Incidentally you should update to the latest npm
if you haven't yet -- latest is 2.1.16 at this writing, and a guide for updating npm
on windows is here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With