38

When and why should we use the option --no-bin-links when we install npm packages?

The official docs say:

The --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain.

But it is still unclear to me for which scenarios we have to specify this.

What will be the impact of the specifying of this option on the functionality of the package? Will the package when used error out?

Mike
  • 14,010
  • 29
  • 101
  • 161
Vijey
  • 6,536
  • 7
  • 43
  • 50
  • Here is an issue whose resolution apparently involved re-installing npm with the --no-bin-links option: https://github.com/phoenixframework/phoenix/issues/2464 – wip May 21 '19 at 06:24

2 Answers2

47

One scenario that I can think of is working with a virtual machine (i.e. vagrant w/ virtual box or VMware) on windows host.
You can't translate symlinks to a synchronized folder on Windows share, so you will need this option to go around it.

Use it for any filesystem that doesn’t support symbolic links.

Andy Theos
  • 3,216
  • 1
  • 15
  • 24
4

So far one of the scenarios that I came across that --no-bin-links may help is when deploying packages in environments that may not have access to NPM Enterprise and you'd want to actually install all the packages and deploy the node_modules directly, in which case symlinks may cause some problem ( as you can't deploy them ), using this flag solve this problem.

mim
  • 1,301
  • 14
  • 24