code-server: [Bug]: Cannot invoke `code-server` from integrated terminal

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Firefox 102
  • Local OS: Win10
  • Remote OS: Ubuntu
  • Remote Architecture: 86
  • code-server --version: 4.5.0 (4.4.0)

Steps to Reproduce

  1. docker run codeserver:latest
  2. try to install extensions via code-server code-server --install-extension ms-python
  3. asd

Expected

Installation of Extension

Actual

Console throws error /usr/lib/code-server/lib/vscode/bin/remote-cli/code-server: 12: /usr/lib/code-server/lib/vscode/node: not found

Logs

No response

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Will be resolved by #5360

My pretty simple idea would be to check inside the code-server script it’s location. So in case of being inside the remote-cli folder instead of the bin it maybe would be a solution to change the way the node location is detected.

So I might be wrong but the only location where upstream vs code prepends the PATH variable with the remote-cli folder is here:

https://github.com/microsoft/vscode/blob/619ab6d1ba7eef9ad418456a5fe5c7805f01a7ab/src/vs/server/node/extensionHostConnection.ts#L53-L59

This is also used to spawn the console (https://github.com/microsoft/vscode/blob/619ab6d1ba7eef9ad418456a5fe5c7805f01a7ab/src/vs/server/node/remoteTerminalChannel.ts#L191) so thats prop. the locaiton where the env variable and thus the PATH gets broken

The way code-server is released(/run?), it behaves like a remote installation. This might be the reason, why /opt/code-server/lib/vscode/bin/remote-cli is prepended to PATH.

Interesting 🤔 I’ll chat with @code-asher and see how we can fix this. Thanks for bringing it up everyone!

I think what’s going on is upstream vscode is injecting an update to the PATH environment variable to an undesirable location.

Here is my invocation that generates the error (note: specifically running /opt/code-server/bin/code-server (where I installed code-server in my container) bypasses the issue):

user 6619ab0c7518 ~
$ code-server --help
/opt/code-server/lib/vscode/bin/remote-cli/code-server: 12: /opt/code-server/lib/vscode/node: not found

And here is my $PATH:

user 6619ab0c7518 ~
$ env | grep PATH
PATH=/home/user/bin:/home/user/.local/bin:/opt/code-server/lib/vscode/bin/remote-cli:/home/user/.local/bin:/home/user/bin:/home/user/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/sonar-scanner/bin:/opt/sonar-scanner/bin

I certainly did not put /opt/code-server/lib/vscode/bin/remote-cli into my PATH myself.