0

I am currently trying to create a new Angular project with Angular CLI version 13.3.10. Yet when I create a new Angular project I still get version 13.3.11.

Before I created this project I ran npm uninstall -g @angular/cli and npm install -g @angular/cli@13.3.10 as an administrator.

Eventhough I uninstalled (checked if it was uninstalled) and installed the desired version ng new {project name} still generates a project with the Angular CLI version 13.3.11. How can that happen?

daandsp
  • 1
  • 2

2 Answers2

0

A solution to your problem could be, installing the preferred version of angular locally inside a folder, just for this particular project.

For Example :

First create a new folder inside any drive. I'm going to create demo folder in D drive. Ex: d:\projects\demo.

Then find this folder inside Command Prompt(cmd) or just type cmd into your created folder address bar in windows and hit enter.

Now type angular specific version command : npm install @angular/cli@13.3.10.

notice there is no -g in that command, because we don't want to install that version globally

which also means that for every new project you have to repeat those steps

After complete the installation, just create new angular project into your specific folder that you recently install angular. Ex: d:\projects\demo.

Now create the project using the command ng new Project_name and it will create your specific angular version Project.

Here is a similiar Post

dimounic
  • 1
  • 2
0

The only thing you can customize here is the version of @angular/cli to be used (it is not documented now but exists for v13 https://github.com/angular/angular-cli/blob/13.3.x/packages/schematics/angular/ng-new/schema.json#L85) ng new --version 13.3.10 Note: it will be with '~' before your version anyway as per template beelow

Angular versions are supposed to be the latest available as per template https://github.com/angular/angular-cli/blob/13.3.x/packages/schematics/angular/workspace/files/package.json.template#L13

  "dependencies": {
    "@angular/animations": "<%= latestVersions.Angular %>",
    "@angular/common": "<%= latestVersions.Angular %>",
    "@angular/compiler": "<%= latestVersions.Angular %>",
    "@angular/core": "<%= latestVersions.Angular %>",
    "@angular/forms": "<%= latestVersions.Angular %>",
    "@angular/platform-browser": "<%= latestVersions.Angular %>",
    "@angular/platform-browser-dynamic": "<%= latestVersions.Angular %>",
    "@angular/router": "<%= latestVersions.Angular %>",
    "rxjs": "<%= latestVersions['rxjs'] %>",
    "tslib": "<%= latestVersions['tslib'] %>",
    "zone.js": "<%= latestVersions['zone.js'] %>"
  },
Lonli-Lokli
  • 3,357
  • 1
  • 24
  • 40