npm
If you're installing code-server vianpm
, you'll need to install additionaldependencies required to build the native modules used by VS Code. This articleincludes installing instructions based on your operating system.
WARNING: Do not use
yarn
to install code-server. Unlikenpm
, it does not respectlockfiles for distributed applications. It will instead use the latest versionavailable at installation time - which might not be the one used for a givencode-server release, andmight lead to unexpected behavior.
Node.js version
We use the same major version of Node.js shipped with Code's remote, which iscurrently22.x
. VS Code alsolists Node.jsrequirements.
Using other versions of Node.jsmay lead to unexpectedbehavior.
Ubuntu, Debian
sudo apt-get install -y \ build-essential \ pkg-config \ python3npm config set python python3
Proceed toinstalling
Fedora, CentOS, RHEL
sudo yum groupinstall -y 'Development Tools'sudo yum config-manager --set-enabled PowerTools # unnecessary on CentOS 7sudo yum install -y python2npm config set python python2
Proceed toinstalling
Alpine
apk add alpine-sdk bash libstdc++ libc6-compat python3 krb5-dev
Proceed toinstalling
macOS
xcode-select --install
Proceed toinstalling
FreeBSD
pkg install -y git python npm-node22 pkgconfpkg install -y libinotify
Proceed toinstalling
Windows
Installing code-server requires all of theprerequisites for VS Code development. When installing the C++ compiler tool chain, we recommend using "Option 2: Visual Studio 2019" for best results.
Next, install code-server with:
npm install --global code-servercode-server# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
Apostinstall.sh
script will attempt to run. Select your terminal (e.g., Git bash) as the default shell for npm run-scripts. If an additional dialog does not appear, run the install command again.
If thecode-server
command is not found, you'll need toadd a directory to your PATH. To find the directory, use the following command:
npm config get prefix
For help and additional troubleshooting, see#1397.
Installing
After adding the dependencies for your OS, install the code-server package globally:
npm install --global code-servercode-server# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
Troubleshooting
If you need further assistance, post on ourGitHub Discussionspage.
Issues with Node.js after version upgrades
Occasionally, you may run into issues with Node.js.
If you install code-server usingnpm
, and you upgrade your Node.jsversion, you may need to reinstall code-server to recompile native modules.Sometimes, you can get around this by navigating into code-server'slib/vscode
directory and runningnpm rebuild
to recompile the modules.
A step-by-step example of how you might do this is:
- Install code-server:
brew install code-server
- Navigate into the directory:
cd /usr/local/Cellar/code-server/<version>/libexec/lib/vscode/
- Recompile the native modules:
npm rebuild
- Restart code-server
Debugging install issues with npm
To debug installation issues, install withnpm
:
# Uninstallnpm uninstall --global code-server > /dev/null 2>&1# Install with loggingnpm install --loglevel verbose --global code-server