Why the portal (yarn link
) protocol cannot handle different versions of the same dependency?
#6655
Replies: 2 comments
-
During an install, Yarn itself will only write to locations "controlled" by it. This includes
(Of course, Notably, this means if you depend on a portal, Yarn can read from the target directory but will refuse to write to it. Otherwise it can lead to some dangerous situations:
So if you use the nm linker, depend on a portal to
However, this means
If foo is a "regular" dependency, it will be installed under the project's
|
Beta Was this translation helpful? Give feedback.
-
Thanks @clemyan, it makes total sense now 🙏 |
Beta Was this translation helpful? Give feedback.
-
Hello!
I'm starting this discussion because I cannot find an answer I can truly understand online, nor in the documentation.
When you use
yarn link
with a local package in a monorepo, if any of the packages using the linked dependency specify a dependency which does not have the same version specified in the linked package, it results in a failed linking step with errorYN0071
.For instance:
foo
specifies dependencybaz
at version1.0.0
.yarn link
to locally linkfoo
bar
in the monorepo specifiesfoo
andbaz
but at version1.2.0
In this scenario yarn fails with the error:
(example message)
My question is, why does the portal protocol need dependencies to be aligned, where if I install the package normally it is not a problem?
Beta Was this translation helpful? Give feedback.
All reactions