code-server
code-server enables running Microsoft's Visual Studio Code on a remote server, accessible via a web browser. This facilitates a consistent development environment across various devices, leveraging cloud server resources for computationally intensive tasks like compilation, testing, and downloads, thereby preserving local device battery life. The current stable version is 4.116.0, which updates to VS Code 1.116.0. The project maintains a frequent release cadence, generally updating monthly to align with new VS Code versions. Key differentiators include its ability to centralize development environments, utilize server-side processing power, and offer a web-based IDE experience without direct client-side VS Code installation. It requires a Linux machine with WebSockets enabled, at least 1GB RAM, and 2 vCPUs, and is built for Node.js 22.
Common errors
-
Error: The Node.js version is too old. Expected 22. Found X.Y.Z
cause `code-server` requires a specific Node.js major version (currently 22) as indicated by its `engines.node` requirement.fixInstall and use the required Node.js version. If using nvm, run `nvm install 22 && nvm use 22`. Otherwise, ensure your system's default `node` executable is version 22. -
code-server: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory
cause Your Linux distribution's `glibc` version is older than what `code-server` requires, leading to missing shared libraries.fixUpgrade `code-server` to v4.114.1 or newer, which explicitly lowered the `glibc` requirement to 2.28. If the issue persists, consider upgrading your OS or running `code-server` in a more modern environment like a Docker container. -
WebSocket connection to 'ws://...' failed: Error during WebSocket handshake: Unexpected response code: 400
cause This typically indicates an issue with `code-server`'s startup arguments, firewall rules, or reverse proxy configuration preventing a successful WebSocket connection.fixEnsure `code-server` is running with the correct `--bind-addr` (e.g., `0.0.0.0:8080` for external access), check server firewall rules, and verify your `--trusted-origins` setting if accessing via a custom domain or reverse proxy. -
Session has been permanently killed. Please reload the window.
cause The client lost connection to `code-server` for longer than the configured (`--reconnection-grace-time`) or default grace period, causing the server to terminate the session.fixIncrease the `--reconnection-grace-time` value when starting `code-server` to allow for longer disconnections, for example: `code-server --reconnection-grace-time 300` (for 5 minutes).
Warnings
- breaking code-server strictly adheres to a specific Node.js major version, currently Node.js 22. Running with an unsupported Node.js version can lead to startup failures or unexpected behavior.
- breaking code-server v4.113.1 fixed an issue where `arm64` and `armv7l` architectures were packaging `amd64` Node binaries due to a CI refactoring mistake in v4.113.0. Users on ARM-based systems might experience startup failures or incorrect architecture detection with v4.113.0.
- gotcha The required `glibc` version was temporarily raised, potentially causing issues on older Linux distributions. Version v4.114.1 reverted this, bringing the requirement back down to 2.28.
- gotcha The `--trusted-origins` configuration now supports wildcard `*.` at the beginning of a domain, allowing `*.example.com` to match both `example.com` and `sub.example.com`. Older configurations expecting only exact matches might need adjustment for broader access or stricter security.
- gotcha The `--reconnection-grace-time` flag was added in v4.113.0, controlling how many seconds clients have to reconnect before a session is permanently killed. This changes default session persistence behavior, which might impact long-running browser sessions or intermittent network connections.
Install
-
npm install code-server -
yarn add code-server -
pnpm add code-server
Quickstart
# Install code-server using the official script curl -fsSL https://code-server.dev/install.sh | sh # The install script will print instructions for running code-server. # A common way to run it is: # code-server --auth password # # For unattended or background operation, you might use nohup or tmux: # nohup code-server --auth password --bind-addr 0.0.0.0:8080 & # # Replace 'yourpassword' with a strong password. # Access it in your browser at the specified address (e.g., http://your-server-ip:8080) # # To specify a specific workspace or folder: # code-server --auth password --bind-addr 0.0.0.0:8080 /path/to/your/project