Menu Expand Search
CS4530, Summer 2025

Setting Up Your Development Environment

This tutorial describes the basic steps needed to set up a development environment with NodeJS, TypeScript, and VisualStudio Code. At the end of this tutorial, you should have a complete local development environment that you can use to build and test code for this class.

Contents:

If you run into any difficulties following any of these steps, please post (in a non-private question) on Piazza.

Installing Node

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.

For this class, you will need Node.js version 23 (v23.11.0 was the latest version at time of writing, although any 23.x should work in theory).

There are many ways that you can install Node.js: for instance, you can use a package manager like snap or homebrew to install it; you can download an installer directly from the Node.js website, and you can, of course, build it from source.

Due to the complexity of running different Node.js versions on the same machine, we very strongly suggest using nvm, the node version manager. When language runtimes are in active development (like Node.js is), sometimes you end up needing to have multiple versions of Node.js installed, and different projects that you work on might require different versions of Node.js. These annoyances are quite rare, but when it happens that you need to have multiple versions of Node.js installed, it’s super handy to have your system set up already so that installing multiple versions and switching between it is easy. You can use our instructions to set up nvm even if you have previously installed Node.js.

Installation Steps (Windows)

Before starting the installation, make sure to kill your Visual Studio Code if you have it installed. To do that on Windows, open a command prompt(type cmd in the windows start bar, then select “Run as administrator”) and run the command taskkill.exe /IM code.exe.

  1. Download nvm-setup.exe from the most recent release of nvm-windows (at time of writing this document, version was 1.2.2).

    image

  2. Run the executable nvm-setup.exe.

    • This should open the nvm installation wizard.
  3. Accept the license agreement and click next. Continue to accept the default choices for any remaining prompts, and click “install”. If you receive messages along the lines of “NodeJS version XYZ is already installed, would you like nvm to control this installation,” select “Yes”.

  4. Upon completion, you will see the below window

    image

  5. Open a command prompt with administrative privileges (type cmd in the windows start bar, then select “Run as administrator”).

  6. Verify the installation, run the command nvm version

    • This should display the version of nvm installed, like this:

      image

  7. Install Node.js version 23 using the command nvm install 23.

  8. To use this version of NodeJS, run the command nvm use 23.

    • The output will look like this:

      Now using node v23.11.0 (npm v10.9.2)

Troubleshooting with VSCode: Did you follow these instructions successfully, but find a “Command not found” error when you try to run npm in VSCode? Try this: Close VSCode completely. Re-open it. In your command shell in VSCode, try again. We have noticed that if you have VSCode open while installing nvm, it is possible that VSCode will not see the new software installation until it’s closed and re-opened. You can also confirm that VSCode correctly sees the NodeJS installation by running echo %PATH% in your windows command shell in VSCode: it should include an entry similar to C:\Program Files\nodejs.

Installation Steps (Linux / Mac)

This tutorial assumes you’re using the Bash or Zsh shells (if you don’t know what that means, you’re probably using one of those). If you use the Fish shell, there are fish instructions here.

  1. Run either

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

    or, if wget is installed, then run

    wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

    For more details, refer to the NVM GitHub.

  2. Close and reopen the active terminal.

  3. Verify nvm is working by entering

    command -v nvm

    If your terminal prints out nvm, it should be working. If you see nvm: command not found or no feedback, open a new terminal and trying again or restart from step 1.

  4. Install the required version of Node.js by typing nvm install 23.

  5. To use this version of NodeJS, run the command nvm use 23.

    • The output will look like this

      Now using node v23.11.0 (npm v10.9.2)

Verification

  1. Open a shell (for Linux / Mac) or windows powershell/command prompt (for Windows).
  2. Run the command node -v
  1. Run the command npm -v
  1. If you find that some other version is being used, run the command nvm use 23. For Linux / Mac, you can change the default to 23 by running the command nvm alias default 23.

Note: The alias command is not compatible with nvm.fish. Instead, you can add a default version with the command exec nvm use 23 in your ~/.config/fish/config.fish file.

Installing Visual Studio Code (VSCode)

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity). VSCode also supports importing hotkey configurations from most other text editors and IDEs. Read more here. While you are required to use an IDE for this class, it is not mandatory to use VSCode: if you already are comfortable developing TypeScript or JavaScript in another suitable IDE (like IntelliJ), then you are welcome to continue to use that. However, VSCode is the “supported” option: if you struggle to get things like the linter set up correctly in VSCode, we will be happy to help you. However, we can’t provide such support for all IDEs.

Pre-requisites

Installation Steps (Windows / Mac)

  1. Download the VSCode installer from the VSCode website.
    • image
  2. Run the installer to start the installation wizard for VSCode
    • image
  3. Accept the license agreement and click next.
    • image
  4. Choose the installation directory of your choice and click next.
    • image
  5. Click next on the select start menu folder screen.
    • image
  6. Tick all check boxes on the select additional tasks menu and click next.
    • image
  7. Review the settings on the the “Ready to install” screen and click Install to begin installation.
  8. Once the installation is complete, you will see the below screen and you are ready to use VSCode.
    • image

Installation Steps (Linux)

  1. Install snap if you haven’t already by running sudo apt update and then sudo apt install snapd.
  2. Install VSCode by running sudo snap install --classic code.
  3. Open VSCode as an application on your desktop.

Additional Extensions (Optional)

VSCode comes with a rich set of extensions to aid in software development. Below is a list of extensions we strongly recommend.

  1. Prettier - Code formatter
  2. ESLint
  3. Code Spell Checker

Additional Configuration

If you click through the menu to Code > Settings > Settings, you should see a screen like this:

image

The following settings are recommended:

  1. “Files: Auto Save” — set to “afterDelay”
  2. “Editor: Format On Save” - enable
  3. “Prettier: Document Selectors” - add *.ts and *.tsx
  4. “Editor > Bracket Pair Colorization” — enable

Getting Started With TypeScript

Typescript is a superscript of JavaScript which adds type information and other features.

Pre-requisites

Hello World

  1. Create a new directory and open it with VSCode.

  2. Create a new file called hello-world.ts. You can do this from within VSC by typing ctrl + N, but this is not necessary.

  3. Add the following code to the file:

    let message = "Hello, World!";
    console.log(message);
    message = "Goodbye, World!";
    console.log(message);
  4. Hover over the message — TypeScript will tell you that the message variable has been inferred to be a string.

    image

  5. Open the terminal with ctrl + ~ or ctrl + ’`’ (ctrl-backtick)

    • Ensure that you are in the same directory as hello-world.ts (the ls command checks what ).
  6. Install typescript by running the command npm install --save typescript .

    • This will install Typescript locally in the current directory.
  7. Initialize a tsconfig.json file by running the command npx tsc --init .

    • This generates a tsconfig.json file with default TypeScript compiler options, which you can customize later if needed.
  8. Run the command npx ts-node hello-world.ts.

    • If you are prompted, enter y.

    • This will give the result below.

      image

Troubleshooting with VSCode: Did you follow these instructions successfully, but find a “Command not found” error when you try to run npm in VSCode? Try this: Close VSCode completely. Re-open it. In your command shell in VSCode, try again. We have noticed that if you have VSCode open while installing nvm, it is possible that VSCode will not see the new software installation until it’s closed and re-opened. You can also confirm that VSCode correctly sees the NodeJS installation by running echo %PATH% in your windows command shell in VSCode: it should include an entry similar to C:\Program Files\nodejs.