Saturday, February 2, 2019

Up and running with Angular 7 in 7 minutes

1. Install node js

Verify by checking versions as follows.

node -v
npm -v

2. Install the Angular CLI

npm install -g @angular/cli

Verify by checking version.

ng --version

3. Install Git

// Use without --global if setting these values on project by project basis
git config --global
git config --global

If a valid email and name is not displayed, set one up using:

git config --global ""
git config --global"Your Name"

4. Verify Sass is installed

Verify by checking version.

npm sass -v

If not installed:

npm install -g sass

5. Create an Angular app

Change to directory where you would like to create the application.

ng new helloang

Routing: Yes
Choose Sass

6. Serve the application

cd helloang

ng serve --open

If you get an error like the following:

ERROR in multi ./src/styles.sass
Module not found: Error: Can't resolve 'C:\Temp\helloang\src\styles.sass' in 'C:\Temp\helloang'

It is because projects created by Angular CLI: 7.3.0 references the wrong extension for styles.scss in angular.json.

Replace styles.sass with styles.scss in angular.json.