Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between `yarn link` and `npm link`?

Seems that sometimes npm link works in situations in which yarn link gives weird errors. I've noticed it a few times. I thought they were both making symlinks under the hood-- are they doing something different?

like image 306
pixelpax Avatar asked Dec 08 '25 12:12

pixelpax


2 Answers

The yarn link and npm link mechanisms are different in the following ways:

  • yarn creates a link directory at the same level as global, where all link softlinks are stored
  • npm modifies the packaged files directly to one address in the public package management path /usr/local/lib/node_modules.

It is possible that the error message is related to yarn's path under generated links, or it could be something else, it still depends on the specific error message.

like image 180
Jenifer Avatar answered Dec 11 '25 01:12

Jenifer


Yarn link simply does not work even in the latest version (currently 4.0.2.)

like image 28
Mist Avatar answered Dec 11 '25 01:12

Mist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!