x
)- [X] bug report -> please search issues before submitting
- [ ] feature request
Windows 10 x64
Node 8.5.0
Angular CLI 1.5.0
Your global Angular CLI version (1.5.0) is greater than your local
version (1.3.1). The local Angular CLI version is used.
To disable this warning use "ng set --global warnings.versionMismatch=false".
@angular/cli: 1.3.1
node: 8.5.0
os: win32 x64
The ng-commands should only use a local version, if I am inside a cli-project.
Anywhere else it should use the global (1.5.0) version.
I have multiple CLI-Projects with different versions (most of them are older test projects which I did not update) in different locations on the hard drive.
For some reason the ng-commands (ng -v
, ng new
etc.) take one of the locally installed cli-versions, no matter in which folder I execute it.
I couldn't even find which "local" version it used.
Running where ng
only returned the global installation under AppData\Roaming
.
Reinstalling cli (npm uninstall -g @angular/cli
, npm cache clear --force
, npm install @angular/cli
) did not solve the issue for me.
Am I missing something or is this a bug?
If I had to bet, you have multiple global node modules somewhere in your system. I've seen other similar reports on windows. Maybe you also have a node_modules somewhere up in the path of where you are running these commands?
It's hard to tell. But we don't have any code to go use a specific CLI version inside specific projects.
I'd check your environment path to see how many node folders are there. Maybe there's a couple of them from older installs.
@filipesilva thank you very much for the fast answer.
I executed where ng
command and it listed only one istallation, so I thought thats the only installation.
But I'll check it again tomorrow and let you know if I found anything.
Btw. Is it possible to get the path of the used ng version (global or local)?
Not that I can think of... We don't have any command that lists the CLI location.
@filipesilva I checked it again and you were right.
I had a Angular-CLI installation inside my user dir. As soon as I removed it, everything worked as expected.
Sorry for any inconvenience and thank you for the quick help :)
Glad to hear that's sorted. Npm problems are often hard to get to the bottom of.
I had the exact same issue, It is a very confusing situation -- thanks for the guidance.
@Springrbua where/how did you locate? Having the same issue but unsure how you solved? Thanks!
I just checked my home dir, as I sometimes accidentaly run npm install in that dir.
I then only removed the node_modukes from there.
I have very simple answer , please issue the below command to resolve the problem
npm install --save-dev @angular/cli@latest
it will update your local cli version.
@varadharaj01 I believe you are misunderstanding the problem. It wasn't the local version that was the problem, it was a somewhat "hidden" global version somewhere in the
@varadharaj01 where do I this? In the folder where the Angular code is present?
In my case, I had angular-cli
globally installed as 1.6.5
version, however the project I was trying to run had "@angular/cli": "1.6.3"
in "devDependencies": { ... }
of it's package.json
file.
since we install all the dependencies of the project, to run / serve of any project, two different versions of ng-cli were accessible inside of that specific project for me. that's why I was getting this error.
solved the issue by changing the version from 1.6.3
to 1.6.5
in package.json
of the project, and running npm i
or yarn install
.
Cheers !
I also sorted by deleting the node_modules
folder and doing a fresh npm install
Thank you. Saves me tons of time.
I have the same message when executing ng serve. My console throws this :
Your global Angular CLI version (1.6.6) is greater than your local
version (1.6.2). The local Angular CLI version is used.
This doesn't prevent me from executing ng serve and launching my website, but I'd like to fix this. I tried to follow the here above advice, but still running into the same error message.
Otherwise, I don't have the problem when launching other angular CLI projects, this appears only for one of my projects.
You have to update the version of angular-cli in your package.json
Run either
Finally updating my angular local version with npm install --save-dev @angular/cli@latest, and running npm install after removing node_modules AND package-lock.json did the trick. Thanks :)
npm install --save-dev @angular/cli@latest
ran at the project location worked for me as well.
Also, another good approach which I use is to remove the cli globally and use it locally. Hopefully npx
allows us to do this:
To create a new project:
npx -p @angular/cli ng new hello-world-project
Then to create a new component for example:
npx ng generate component my-component
https://medium.com/@starikovs/how-to-use-angular-cli-locally-729dbb6707dd
i have installed version angular 7 globally from command prompt, but the project which i'm using version is
angular 5, so how to make this project from v.5 to v.7.... , help me out this plz
You have to migrate this Project to Angular 7.
You can find out how to do that on https://update.angular.io
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
I have very simple answer , please issue the below command to resolve the problem
npm install --save-dev @angular/cli@latest
it will update your local cli version.