Introduction
Recently, I am going to learn the source code of vscode. The first step is to run it.
The steps I followed are mostly based on the official contribution documentation:
Here are some key steps distilled from there. For accuracy, please refer to the official documentation.
Steps
Since VSCode’s compilation involves using node-gyp, which can be troublesome to install on Windows, my plan is to run it in WSL (Windows Subsystem for Linux).
- Environment Setup Ensure you have Git, Node.js, Yarn, Python, and C++ toolchain installed in your WSL:
- Git
- Node.js, x64, version
>=18.15.x and <19
- Yarn 1, version
>=1.10.1 and <2
, follow the installation guide - Python (required for node-gyp; refer to node-gyp readme for supported Python versions)
- C/C++ compiler toolchain for your platform:
- It’s recommended to use VSCode for development. Install VS Code and the Remote – WSL extension.
- Install Dependencies
- Start Electron The first execution might be slow; wait for about 2 minutes, and it should start.
Errors
Error while executing ./scripts/code.sh
If you encounter errors while running ./scripts/code.sh
, it might be due to missing C++ toolchain dependencies. Errors like:
Cannot find module ‘ternary-stream’
Cannot find module ‘vscode-gulp-watch’
gssapi.h error
Installing C++ dependencies should resolve these issues.
gyp error during yarn dependency installation
Another common error involving node-gyp:
You can try clearing dependencies and reinstalling them:
“not a valid Electron app” warning
This is an official warning. Just take note and execute: