I’m not used to working with Angular or JavaScript in general, so please forgive me if this is a simple or common problem. I’ve been searching for a solution for most of the day, but I haven’t found anything yet.
It started with me creating a new project to start getting my hand in and found that app.routes.ts wasn’t being created (I was following the guide on the Angular site to create routes). After some checking, ng new was creating a project targeting angular/core 15.2. Tried ‘ng -v’ and it came up with Angular CLI version 15.2.4 and outdated node and npm versions.
I’ve updated node and npm to versions 20.14.0 and 10.7.0 respectively. But I can’t seem to get the cli up to date. If I run ‘npm update -g @angular/cli@latest’ it doesn’t throw an error but ng v still returns 15.2.4. I tried ‘npm install -g @angular/cli@latest’ to see if it would overwrite it, but ng v shows 15.2.4. Then I tried running ‘npm uninstall -g @angular/cli’ and it shows no errors. But ng v shows 15.2.4, which is weird since it shouldn’t be installed at all at the point.
Now we get to the point that’s got me throwing my hands up in defeat, if I run ng v now, it shows 15.2.4, but… if I run ‘npm list -g’ it shows @angular/[email protected].
I can get ng v to return 18.0.4 if I install it locally with ‘npm install @angular/cli@latest’, but if I then use ‘ng new’ in that folder it still seems to set it up with the version 15 cli.
One thing I can think of, but can’t test is that it’s because I’m not running npm with an Administrator account (Windows 10). Not sure how it would cause ng v and npm list to show different versions but I’m out of other ideas.