Do you want to request a feature or report a bug?
bug (in as it relates to npm behavior)
What is the current behavior?
Running yarn link on a package folder does not add a symlink to the global packages for yarn, preventing it from being required as a global package elsewhere.
If the current behavior is a bug, please provide the steps to reproduce.
cd /my-module
yarn link
Trying to require('my-module') globally does not work.
What is the expected behavior?
I'd expect this to behave like npm where a npm link will allow the module to be required globally.
Please mention your node.js, yarn and operating system version.
Node 6. Yarn 0.18.0. MacOS Sierra.
As an aside. I get around this now by:
cd my-module
yarn link
cd ~/.config/yarn/global
yarn link my-module
I can't replicate your behavior at all with normal npm. Just running npm link does create symlinks into /usr/local/lib/node_modules, but that path is not on the node package search tree by default (at least on OS X 10.12).
I think yarn link has the correct behavior - as you want to explicitly link your development/local copy into other packages, not immediately turn it on as a global for all node packages, which could potentially cause many unforeseen issues.
cd my-module
yarn link
cd ../other-module
yarn link my-module
Most helpful comment
I can't replicate your behavior at all with normal
npm. Just runningnpm linkdoes create symlinks into/usr/local/lib/node_modules, but that path is not on the node package search tree by default (at least on OS X 10.12).I think
yarn linkhas the correct behavior - as you want to explicitly link your development/local copy into other packages, not immediately turn it on as a global for all node packages, which could potentially cause many unforeseen issues.