Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn-Linked Packages may not work in Che-Theia #18937

Open
1 of 3 tasks
tsmaeder opened this issue Feb 1, 2021 · 3 comments
Open
1 of 3 tasks

Yarn-Linked Packages may not work in Che-Theia #18937

tsmaeder opened this issue Feb 1, 2021 · 3 comments
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.

Comments

@tsmaeder
Copy link
Contributor

tsmaeder commented Feb 1, 2021

Describe the bug

I came across this problem when investigating using `yarn link' for building che-theia. Imagine this scenario:

/projects/moduleA
  package.json
  some-typescript-files.ts
/projects/moduleB
  package.json
  some-more-typescript.ts

moduleB imports stuff from moduleA. If we want to build moduleB against the master version of moduleA, we'll use the following:

cd /projects/moduleA && yarn link
cd /projects/moduleB && yarn link moduleA

now you can invoke yarn inside /projects/moduleBand 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 the yarn link in moduleA, yarn creates a symlink in ~/.config/yarn/link. When I later do yarn 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 linkin/projects/moduleA` again each time you restart the workspace.

Che version

  • latest
  • nightly
  • other: please specify
@tsmaeder tsmaeder added the kind/bug Outline of a bug - must adhere to the bug report template. label Feb 1, 2021
@ericwill
Copy link
Contributor

ericwill commented Feb 1, 2021

As discussed in the standup, I think making the home folder persistent would be a good step in the right direction.

@ericwill ericwill added area/editor/theia Issues related to the che-theia IDE of Che area/plugins labels Feb 1, 2021
@tsmaeder
Copy link
Contributor Author

tsmaeder commented Feb 2, 2021

The relevant issue is #15421

@ericwill ericwill added the severity/P2 Has a minor but important impact to the usage or development of the system. label Feb 3, 2021
@che-bot
Copy link
Contributor

che-bot commented Aug 9, 2021

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 9, 2021
@tsmaeder tsmaeder added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants