How to install Angular 8 locally

how-to-install-angular-8-locally-feature-image

When you have updated Angular CLI using npm install -g @angular/cli[@version], everytime you create Angular project using the ng new command, the project is generated with Angular version corresponding to that Angular CLI version. Angular 8 is latest Angular version that we may want to use in limited number of projects at the time it has just been released. In this tutorial, we’re gonna show you 2 ways to install new Angular 8 project locally in specific folder.

Overview

This is our current Angular CLI version:

how-to-install-angular-8-project-locally

We have 2 ways to setup new Angular project with specific Version:
– using npx => don’t need to install Angular CLI locally
– using local Angular CLI => need to generate a local folder for node_modules

Install Angular 8 locally using npx

Install npx

Run command: npm i -g npx

Setup new Angular project

Now, if we want to create Angular 8 project in a specific folder, just run the command on that folder:

npx -p @angular/cli@8.0.0-beta.2 ng new Angular8SpringBoot

You can change 8.0.0-beta.2 to your appropriate Angular CLI version. Run command ng --version on project folder, the result would be like:

how-to-install-angular-8-project-locally-successful

Check package.json file:

{
   "name": "angular8-spring-boot",
   "version": "0.0.0",
   "scripts": {
     "ng": "ng",
     "start": "ng serve",
     "build": "ng build",
     "test": "ng test",
     "lint": "ng lint",
     "e2e": "ng e2e"
   },
   "private": true,
   "dependencies": {
     "@angular/animations": "~8.0.0-beta.5",
     "@angular/common": "~8.0.0-beta.5",
     "@angular/compiler": "~8.0.0-beta.5",
     "@angular/core": "~8.0.0-beta.5",
     "@angular/forms": "~8.0.0-beta.5",
     "@angular/platform-browser": "~8.0.0-beta.5",
     "@angular/platform-browser-dynamic": "~8.0.0-beta.5",
     "@angular/router": "~8.0.0-beta.5",
     "core-js": "^2.5.4",
     "rxjs": "~6.4.0",
     "tslib": "^1.9.0",
     "zone.js": "~0.8.26"
   },
   "devDependencies": {
     "@angular-devkit/build-angular": "~0.14.0-beta.2",
     "@angular/cli": "~8.0.0-beta.2",
     "@angular/compiler-cli": "~8.0.0-beta.5",
     "@angular/language-service": "~8.0.0-beta.5",
     "@types/node": "~8.9.4",
     "@types/jasmine": "~3.3.8",
     "@types/jasminewd2": "~2.0.3",
     "codelyzer": "~4.5.0",
     "jasmine-core": "~2.99.1",
     "jasmine-spec-reporter": "~4.2.1",
     "karma": "~4.0.0",
     "karma-chrome-launcher": "~2.2.0",
     "karma-coverage-istanbul-reporter": "~2.0.1",
     "karma-jasmine": "~2.0.1",
     "karma-jasmine-html-reporter": "^1.4.0",
     "protractor": "~5.4.0",
     "ts-node": "~7.0.0",
     "tslint": "~5.11.0",
     "typescript": "~3.2.2"
   }
}

Install Angular 8 locally using local Angular CLI

Install local Angular CLI

Go to the folder that you want to generate all Angular projects with the specific version, run command:
npm install @angular/cli@8.0.0-beta.2

node_modules folder will be generated.

Setup new Angular project

On the folder that you’ve installed Angular CLI, run the familiar command:
ng new angular-8-foo

Now run the ng --version command on project folder, the result would be like:

how-to-install-angular-8-project-locally-angular-cli-successful


By grokonez | February 27, 2019.


Related Posts


Got Something To Say:

Your email address will not be published. Required fields are marked *

*