Yarn-Linked Packages may not work in Che-Theia #18937
Labels
area/editor/theia
Issues related to the che-theia IDE of Che
area/plugins
kind/bug
Outline of a bug - must adhere to the bug report template.
lifecycle/frozen
Indicates that an issue or PR should not be auto-closed due to staleness.
severity/P2
Has a minor but important impact to the usage or development of the system.
Describe the bug
I came across this problem when investigating using `yarn link' for building che-theia. Imagine this scenario:
moduleB imports stuff from moduleA. If we want to build moduleB against the master version of moduleA, we'll use the following:
now you can invoke
yarn
inside/projects/moduleB
and you'll compile against the current state of/projects/moduleA
. However, if you open an editor in moduleB on a file that imports from moduleA, you'll see an error on the import saying the module cannot be found.What happened? I'm assuming we're using a devfile derived from our nodejs/yarn sample, the nodejs container will have home directory of
/home/user
. When I do theyarn link
in moduleA, yarn creates a symlink in~/.config/yarn/link
. When I later doyarn link moduleA
in moduleB, a symlink to~/.config/yarn/link/moduleA
is created inside/projects/moduleB/node_modules
. So the compile now succeeds. However, in the che-theia container, there are two problems: first, the home folder is not shared among the different containers. So the linked module in~/.config/yarn/link
simply don't exist. And even if we declared a shared volume in the devfile for/home/user/.config/yarn/link
it would not help: the link in/projects/moduleB/node_modules
is to/home/user/.config/yarn/link
. However, the yarn link folder in the theia container is under/home/theia/.config/yarn/link
.There is also a second problem: since the home directory is not on a persistent, volume, you'll have to run the 'yarn link
in
/projects/moduleA` again each time you restart the workspace.Che version
The text was updated successfully, but these errors were encountered: