Angular Queries

Angular CLI & Troubleshooting

You encountered issues during the installation of the CLI or setup of a new Angular project?

A lot of problems are solved by making sure you’re using the latest version of NodeJS, npm and the CLI itself.

Updating NodeJS:

Go to nodejs.org and download the latest version – uninstall (all) installed versions on your machine first.

Updating npm:

Run [sudo] npm install -g npm  (sudo  is only required on Mac/ Linux)

Updating the CLI

[sudo] npm uninstall -g angular-cli @angular/cli

npm cache clean

[sudo] npm install -g @angular/cli

Here are some common issues & solutions:

  1. Creation of a new project takes forever (longer than 3 minutes)
    That happens on Windows from time to time => Try running the command line as administrator
  2. You get an EADDR error (Address already in use)
    You might already have another ng serve process running – make sure to quit that or use ng serve --port ANOTHERPORT to serve your project on a new port
  3. My changes are not reflected in the browser (App is not compiling)
    Check if the window running ng serve displays an error. If that’s not the case, make sure you’re using the latest CLI version and try restarting your CLI

If the CLI prompts you to answer some questions (some versions do that), you can simply hit ENTER for all questions.

Depending on the CLI version you’re using, you might also need to add the FormsModule  to the imports[]  array in your app.module.ts  file (add it if you don’t see it there).

If you don’t have FormsModule  in imports[]  in AppModule , please do add it and also add an import at the top of that file: import { FormsModule } from '@angular/forms';

If you want to dive deeper into the CLI and learn more about its usage, have a look at its official documentationhttps://github.com/angular/angular-cli/wiki

Recent Posts

How to Install Angular on Ubuntu (18.04 & 16.04)

Angular is a TypeScript-based, open-source web application framework led by the Angular Team at Google.…

4 years ago

Install Node.js in Ubuntu

Installation instructions Node.js v14.x: [crayon-6637601db2e34360146496/] Node.js v13.x: [crayon-6637601db2e3a402851226/] Node.js v12.x: [crayon-6637601db2e3c646508089/] Node.js v10.x: [crayon-6637601db2e3e441258618/] Node.js…

4 years ago

What is the difference between one-way binding and two-way binding ?

In One-Way data binding, view (UI part) not updates automatically when data model changed. We…

5 years ago