Skip to content

Visual Studio Code

Visual Studio Code (usually just called VS Code) is the code editor we use to write and work on our projects. It’s free, it’s lightweight, and it has built-in support for Git and a terminal, so most of your day-to-day work can happen in one window.

Before downloading anything, know that Visual Studio Code and Visual Studio are two completely different programs. Microsoft gave them nearly the same name, and it trips up almost everyone at least once.

Visual Studio Code Visual Studio
What it is A lightweight code editor A full, heavyweight IDE
Icon Blue Purple
Download size Around 100 MB Several GB
Mostly used for Web development, JavaScript, Python, and just about anything else C#, C++, and .NET development on Windows
Cost Free Free Community edition, paid Professional and Enterprise editions

We want Visual Studio Code. If the installer you downloaded is asking you to pick “workloads” or wants to download several gigabytes, you’ve grabbed Visual Studio by mistake. Close it and start over with the link below.

Go to the VS Code download page. Double-check that the page says Visual Studio Code at the top.

For Windows, click the big Windows button. This downloads the User Installer, which installs VS Code just for your account and doesn’t need administrator permissions. That’s the one we want.

If you’re on a Mac or Linux, pick the download for your operating system instead.

Once it has been downloaded, open the installer from your Downloads folder and follow the prompts:

  1. Accept the license agreement and click Next.

  2. Leave the install location as the default and click Next.

  3. Leave the Start Menu folder as the default and click Next.

  4. On the Select Additional Tasks screen, check these boxes:

    • Add “Open with Code” action to Windows Explorer file context menu
    • Add “Open with Code” action to Windows Explorer directory context menu
    • Add to PATH (this one should already be checked, make sure it stays that way)

    The two “Open with Code” options let you right-click any file or folder and open it straight in VS Code, which is handy. Add to PATH lets you launch VS Code from the command line, which we’ll use in the next step.

  5. Click Next, then Install.

  6. Click Finish once it’s done.

If you had a Command Prompt window open from before, close it and open a new one. Command Prompt only picks up newly installed programs when it starts.

Open the command line by pressing your Windows key and searching for cmd, then run the application called Command Prompt.

Get VS Code version
code --version

It should print out a few lines, starting with a version number like 1.104.0. The exact number doesn’t matter, as long as you get a number and not an error.

VS Code works best when you open a whole folder (your project) rather than one file at a time. Make a test folder, move into it, and open it in VS Code:

Open a folder in VS Code
mkdir vscode-test
cd vscode-test
code .

The . means “the folder I’m currently in.” VS Code should pop open with VSCODE-TEST shown in the Explorer panel on the left.

The first time you open a folder, VS Code may ask “Do you trust the authors of the files in this folder?” Since you made this folder yourself, click Yes, I trust the authors.

In the Explorer panel, click the New File icon next to the folder name, and name the file hello.js. Type something into it and save it with Ctrl + S.

VS Code has a command line built right into it. Open it with Ctrl + ` (the backtick key, just above Tab), or from the menu bar under Terminal > New Terminal.

This is the same kind of command line you’ve been using in Command Prompt, except it automatically starts inside your project folder. If you’ve already installed Git, try running this in it:

Get git version from VS Code
git --version

If it prints a version number, VS Code can see Git and you’re all set.

You can delete the vscode-test folder once you’re done. We won’t need it again.

'code' is not recognized as an internal or external command

Section titled “'code' is not recognized as an internal or external command”

Windows can’t find VS Code yet. Close every Command Prompt window and open a new one. If that doesn’t fix it, restart your computer. If it still doesn’t work, run the installer again and make sure Add to PATH is checked on the Select Additional Tasks screen.

Running code opens a purple program instead

Section titled “Running code opens a purple program instead”

You installed Visual Studio instead of Visual Studio Code. See the section above and install VS Code from the VS Code download page.

Commands like npm fail in the VS Code terminal with “running scripts is disabled on this system”

Section titled “Commands like npm fail in the VS Code terminal with “running scripts is disabled on this system””

VS Code’s terminal uses PowerShell by default, which blocks some scripts. See the NPM troubleshooting section for the fix.