How to resolve the "ng: command not found" Error

How to resolve the "ng: command not found" Error

When setting up a new laptop and running an Angular project, you might encounter the ng: command not found error. This happens because the Angular CLI is not installed on your machine. Here’s how to resolve it:

Steps to Fix the Error

  1. Install Angular CLI Open your terminal and run:

     npm install -g @angular/cli
    

    This installs the Angular CLI globally, making the ng command available anywhere on your system.

  2. Verify Installation Check if Angular CLI is installed correctly:

     ng version
    
  3. Serve Your Project Navigate to your project directory and run:

     ng serve
    

By following these steps, you can ensure the Angular CLI is properly set up, and you can run your project without issues.

Hope this helped☺️