DEV Community

mohamed Tayel
mohamed Tayel

Posted on

Angular Fundamentals: Setting Up Your Angular Development Environment Using Command Prompt

When building Angular applications, you need to install several tools in your development environment. This guide will walk you through setting up your environment step-by-step, using Command Prompt (CMD) on Windows. We will install Node.js, manage multiple Node.js versions using NVM for Windows, and install the Angular CLI.

1. Install a Code Editor: Visual Studio Code

Before we dive into setting up Node.js and Angular CLI, let’s make sure you have a good code editor. We highly recommend Visual Studio Code (VS Code), which is a lightweight yet powerful editor for web development. It supports features like syntax highlighting, code formatting, and seamless integration with Angular.

  • You can download VS Code from the official website.
  • Install the version suitable for your operating system.

Once installed, you're ready to proceed with setting up the tools for Angular.

2. Install Node.js using NVM for Windows

To work with Angular, you need Node.js, which allows you to run JavaScript outside the browser. Additionally, npm (Node Package Manager), which comes with Node.js, will help you install packages like the Angular CLI.

Instead of installing Node.js directly, we will use NVM (Node Version Manager) for Windows. NVM allows you to manage and switch between different versions of Node.js, which is helpful when working with multiple projects that might require different Node versions.

Step-by-Step Guide to Installing NVM for Windows:
  1. Download NVM for Windows from the official NVM for Windows GitHub repository. Scroll down and find the latest nvm-setup.exe file.

  2. Run the installer:

    • Accept the terms and conditions.
    • Choose the default installation settings.
  3. Once installed, open Command Prompt (CMD) by typing cmd in the Windows search bar and selecting the Command Prompt app.

  4. Verify NVM is installed by running the following command:

    nvm version
    

    You should see the installed version of NVM displayed in the terminal.

Installing Node.js Using NVM for Windows:

Now that NVM is installed, you can use it to install Node.js. Here’s how:

  1. To install a specific version of Node.js, use the following command:

    nvm install node
    

    This command will download and install Node.js version last version You can replace current version with any other version you prefer.

  2. After installation, activate the Node.js version using:

    nvm use 22.9.0
    

    This switches your environment to use the specified Node.js version.

  3. To check the current version of Node.js installed, run:

    node -v
    

    You should see the version you installed (e.g., 18.10.0).

Switching Between Node.js Versions:

NVM for Windows allows you to switch between different versions of Node.js easily. For example, if you need to use another version for a different project, you can install and switch versions like this:

  1. Install another version of Node.js (e.g., version 16.0.0):

    nvm install 16.0.0
    
  2. Switch to this version:

    nvm use 16.0.0
    
  3. To see all installed Node.js versions:

    nvm list
    

3. Install Angular CLI Using CMD

With Node.js set up, the next step is to install the Angular CLI. The Angular CLI is a command-line tool that helps you scaffold, build, and run Angular applications.

To install Angular CLI globally using CMD, follow these steps:

  1. In Command Prompt (CMD), run the following command to install Angular CLI globally:

    npm install -g @angular/cli
    

    This will download and install the latest version of Angular CLI globally on your system, so you can use it in any project.

  2. After installation, verify the Angular CLI version by running:

    ng version
    

    You should see information about your Angular CLI version and other related Angular packages.

Summary

To recap, we’ve walked through the following steps using Command Prompt (CMD):

  • Installed Node.js using NVM for Windows for better version management.
  • Installed the Angular CLI using npm.

Now your environment is set up, and you’re ready to start building Angular applications efficiently. Enjoy coding!

Top comments (0)