Installing The Prerequisite

  • Node.js and NPM : You can download Node.js from https://nodejs.org. NPM comes bundled with Node.js.
  • angular-cli : You can install angular-cli by executing following command from your terminal: npm install -g @angular/cli . More details can be found here https://github.com/angular/angular-cli.

Installing The NPM Packages

  • Before proceding you'll need to install npm packages. You can do this by running npm install from the root of your project to install all the necessary dependencies.

Development Server

  • Run ng serve or ng serve -aot for a dev server. Navigate to http://localhost:4200/ . The app will automatically reload if you change any of the source files.

Code Scaffoldings

  • Run ng generate component component-name to generate a new component. You can also use ng generate directive/pipe/service/class

Building

  • Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Preloading Strategy

  • Provides a preloading strategy that preloads all modules as quickly as possible.
  • To get more help on the PreloadAllModules check out the https://angular.io/api/router/PreloadAllModules .
  • You can put this code in app-routing.module.ts.

Further Help

  • To get more help on the angular-cli use ng --help or go check out the Angular-CLI README .

FAQs

  • Unable to resolve dependency tree errors
    While installing node package, if you are getting error i.e Unable to resolve dependency tree errors then below solution might be helpful to you.
    It seems that the older peer dependencies from your system causing this issue. This happens for some packages after updating to npm 7 . Paramter --legacy-peer-deps can help:
  • npm i --legacy-peer-deps
  • FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
    Its probably because of a memory leak. Usually just increasing the memory allocated to Node will allow your program to run. To increase the memory, in the terminal where you run your Node process:
  • export NODE_OPTIONS="--max-old-space-size=8192"