yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.39k stars 2.73k forks source link

yarn link error message is not helpful #7054

Open domoritz opened 5 years ago

domoritz commented 5 years ago

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 commented 5 years ago

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

markbrocato commented 5 years ago

+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.

domoritz commented 5 years ago

Or have a -f flag to override the link.

good-idea commented 5 years ago

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.

Dhana-Krishnasamy commented 4 years ago

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

DominicTobias-b1 commented 4 years ago

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
mv92 commented 3 years ago

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

MurzNN commented 3 years ago

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.

fragsalat commented 2 years ago

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

worph commented 2 years ago

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

ajubin commented 1 year ago

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

satishgadhave commented 1 year ago

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