yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.37k stars 1.1k forks source link

yarn link fails using `YARN_IGNORE_PATH` #5339

Open deepeshmittal opened 1 year ago

deepeshmittal commented 1 year ago

I am trying to link a package A which is on yarn 3 to another app B which is on yarn 1.

In yarn1 guide it says "if you want to link yarn 3+ project into project which uses older versions of yarn" (which is my scenario) use: YARN_IGNORE_PATH=1 yarn link to register the package. However using the commands getting error:

Unknown Syntax Error: Not enough positional arguments.

$ yarn link [-A,--all] [-p,--private] [-r,--relative] <destination>
le0m commented 1 year ago

Does anyone have a solution? Maybe @larixer knows more, since he commented the same solution on #90 (comment)?

EDIT: as a workaround, I'm manually creating a symlink for the Yarn 3 project with ln -s $PWD $HOME/.config/yarn/link/<package-name> and then running yarn link from the Yarn 1 project as normal.

EDIT again: a coworker is using the YARN_IGNORE_PATH=1 yarn link command with success in a monorepo with multiple packages, while my problem is in a single-package project. I think the issue is that the command works only with monorepos.

gcoakleyjr commented 6 months ago

Thank you so much @le0m , I changed laptops, and previously YARN_IGNORE_PATH=1 yarn link worked fine in my multi repo set up, but on my new laptop, same repo setup, however, YARN_IGNORE_PATH=1 yarn link wasn't working at all. Don't know why, but your workaround helped me.