angularangular-cliangular13

Local Angular CLI version greater than global


I am 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.

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


Solution

  • 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