Home > database >  How to create angular app with latest version (current is 12)
How to create angular app with latest version (current is 12)

Time:10-10

Trying to create an angular application, I dont understand how is possible with version 12 instead of version 8. Yes, ... because ng new app is actually creating applications in version 8.

ng version

This is the output of ng version. Current angular version is Angular: 8.2.14 but I would create an application with version 12.*

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.29
Node: 14.17.3
OS: darwin x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.29
@angular-devkit/build-angular     0.803.29
@angular-devkit/build-optimizer   0.803.29
@angular-devkit/build-webpack     0.803.29
@angular-devkit/core              8.3.29
@angular-devkit/schematics        8.3.29
@angular/cli                      8.3.29
@ngtools/webpack                  8.3.29
@schematics/angular               8.3.29
@schematics/update                0.803.29
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

ng update @angular/cli@9

The command fails:

The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 33 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "@angular/compiler-cli" (requires ">=9.0.0 < 10", would install "13.0.0-next.15")
                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.6 < 3.9", would install "4.4.3")
✖ Migration failed: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.
  See "/private/var/folders/45/63w301n97l3d90j_5n39_kpr0000gn/T/ng-h5yjfi/angular-errors.log" for further details.

?

How to create angular12 application?

CodePudding user response:

Instead of ng new <my-project> you can use

npx @angular/cli@12 new <my-project> 

This will create @angular/cli app with 12.x.x version.

Other options:

npx @angular/cli new <my-project> - latest version

npx @angular/[email protected] new <my-project> - 12.2.2 version

CodePudding user response:

Remove globally your old cli

npm uninstall -g @angular/cli

Clear the cache

npm cache clean --force

Install the latest version of angular cli by using the following command.

npm install -g @angular/cli@latest
  • Related