eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.99k stars 1.19k forks source link

[UDI] Configure UDI images to allow `npm install -g` within workspaces #21742

Open amisevsk opened 2 years ago

amisevsk commented 2 years ago

Is your enhancement related to a problem? Please describe

Some node projects rely on packages installed from npm/yarn, e.g. gulp. Currently, the UDI images used by default in workspaces do not necessarily have all required packages installed, and provide no easy means of installing them -- npm install -g in workspaces fails with a permissions error attempting to write to /usr/local/lib/node_modules.

Describe the solution you'd like

We probably don't want to pre-install every possible dependency in the container itself, but we can enable installing dependencies within workspaces by configuring npm and yarn to use writeable directories:

Then adding PATH=$PATH:/projects/.node_modules_global/bin/:/projects/.yarn_global/bin/ should allow using npm install -g <package> or yarn global add <package> in workspaces.

Describe alternatives you've considered

Alternatively, another writeable path, outside the shared /projects directory could be used. This would mean that installed modules do not use workspace storage, but also means that installed packages are lost when the workspace restarts.

Additional context

Initially raised in https://github.com/eclipse/che/issues/21741

che-bot commented 1 year ago

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.

amisevsk commented 1 year ago

/remove-lifecycle stale

che-bot commented 9 months ago

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.

AObuchow commented 9 months ago

/remove-lifecycle stale