Angular Setup & First App
In this lecture, we'll create a new Angular project
To ensure that this works, for the moment, make sure that you have the LTS version of NodeJS installed, NOT the latest version (from https://nodejs.org/en/).
Especially double-check that you have npm version 6 installed - it's a tool that's installed together with NodeJS.
We need that tool to install the Angular CLI and create new Angular projects with that CLI.
Since npm v7 can cause issues, you should ensure that you use v6. Therefore, also run
npm install -g [email protected] to ensure that you are using that version (on macOS, you might need to add
sudo in front of that command).
Thereafter, you can proceed to creating a new Angular project.
If you want to dive deeper into the CLI and learn more about its usage, have a look at its official documentation: https://github.com/angular/angular-cli/wiki
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.
Go to nodejs.org and download the latest version - uninstall (all) installed versions on your machine first.
[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:
- 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
- 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 ANOTHERPORTto serve your project on a new port
- My changes are not reflected in the browser (App is not compiling)
- Check if the window running
ng servedisplays an error. If that's not the case, make sure you're using the latest CLI version and try restarting your CLI