yarn icon indicating copy to clipboard operation
yarn copied to clipboard

yarn link error message is not helpful

Open domoritz opened this issue 6 years ago • 10 comments

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Running link for a linked package shows:

warning There's already a package called "vega" registered. This command has had no effect. If this command was run in another folder with the same name, the other folder is still linked. Please run yarn unlink in the other folder if you want to register this folder.

What is the expected behavior?

There is no note about where the link is so it's hard to unlink.

Please mention your node.js, yarn and operating system version.

yarn 1.13.0

domoritz avatar Feb 21 '19 00:02 domoritz

For anyone else coming here, you can delete the link in ~/.config/yarn/link

domoritz avatar Feb 21 '19 00:02 domoritz

+1 On this. I strongly suggest getting rid of this error message entirely and changing the behavior. Just overwrite the existing link. That's what npm does, and in my experience is the most helpful behavior in 99% of cases.

markbrocato avatar Mar 22 '19 12:03 markbrocato

Or have a -f flag to override the link.

domoritz avatar Mar 22 '19 13:03 domoritz

One way to find where the original link points to is viewing the symlink that yarn creates: ls -lsa ~/.config/yarn/link.

Another frustration with this error message is that it will appear even if you are in the originally linked directory.

good-idea avatar May 25 '19 00:05 good-idea

On Windows delete the link in : C:\Users<user name>\AppData\Local\Yarn\Data\link

Dhana-Krishnasamy avatar Jan 14 '20 12:01 Dhana-Krishnasamy

This message and the behaviour is baad. The default assumption should be to overwrite the link IMO.

  1. Keep the default behaviour no one wants but add a helpful message like "Remove the link at {path}"
  2. Provide flags like sym link does to overwrite (-sfn)
  3. Go with the assumption that everyone wants to create a link when they type yarn link, which I think they do

DominicTobias-b1 avatar Jul 23 '20 04:07 DominicTobias-b1

2 years later. Error is still the exact same form as in 2019. this is just sad...

mv92 avatar Apr 26 '21 19:04 mv92

Will be good to show, at least, the current location of already registered link in output message! And do not warn if the link is already pointing to current folder.

MurzNN avatar Jun 11 '21 10:06 MurzNN

Just as FYI because I found this issue. You can simply just run yarn unlink -g <package> and it's unlinked.

fragsalat avatar Apr 25 '22 09:04 fragsalat

On Windows delete the link in : C:\Users\AppData\Local\Yarn\Data\link

For (lazy) windows users the generic url (Copy/Paste in the explorer) %userprofile%\AppData\Local\Yarn\Data\link

worph avatar Aug 16 '22 11:08 worph

To ignore the warning, you can run yarn link 2> /dev/null on unix system, see https://linuxhandbook.com/redirect-dev-null/ for more

ajubin avatar Dec 05 '22 14:12 ajubin

For anyone else coming here, you can delete the link in ~/.config/yarn/link

On CentOS the path is /usr/local/share/.config/yarn/link

satishgadhave avatar Feb 03 '23 06:02 satishgadhave