Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When and Where Angular CLI Has Been Installed Locally?

After installing Node.js, I imported an Angular project from GitHub on VSCode, then I run the following usual commands successively:

npm install                      //This one created node_modules folder, but I don't have angular cli yet, because ng is still not recognized!
npm install -g @angular/cli      //Then after the installation of the global CLI finished..
ng --version

Now I get the following warning:

Your global Angular CLI version (7.3.5) is greater than your local version (7.3.2). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".

This question is trying to explain that warning, but they are not explaining where and when the local CLI is installed, at least in my case here.

Please give some clarification, thanks.

Edit

Here are the dependencies in pakage.json, according to your comments, they are related, but what is the usual scenarios if there is no explicit CLI version definition?.

    "dependencies": {
    "@angular/animations": "^7.2.6",
    "@angular/cdk": "^7.3.3",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/material": "^7.3.3",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "angular-formio": "^3.10.2",
    "bootstrap": "^4.3.1",
    "bootswatch": "^4.3.1",
    "core-js": "^2.5.4",
    "font-awesome": "^4.7.0",
    "jquery": "^3.3.1",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "~7.3.1",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
like image 585
SourceCode Avatar asked Jan 19 '26 22:01

SourceCode


1 Answers

The global version is installed with npm install -g @angular/cli@latest.

The local version is inside of your project in node_modules under node_modules/@angular/cli. You have to update your package.json to the same version as your global version.

The @angular/cli is installed locally when you run ng new appName.

And it is installed with every run of npm install in your project root.

To update it you need to change this line in package.json

...
"@angular/cli": "~7.3.2",
...

To this

...
"@angular/cli": "~7.3.5",
...

And then run npm install

like image 146
Josef Katič Avatar answered Jan 22 '26 12:01

Josef Katič



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!