When uninstalling Angular CLI (@angular/cli) the angular version is still 6.2.0

517 views Asked by At

I'm trying to update my angular-cli version to the latest, and for that I'm doing:

npm uninstall -g @angular/cli
npm cache verify

After that, I closed and opened again the terminal and typed in an empty folder:

ng -v 

and the output was: 6.2.0

I also tried to install the latest version of angular with:

npm install -g @angular/cli@latest

and then executing

ng new my-app

but the next error showed:

npm ERR! path /home/<path>/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/raul/<path>/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/<my_name>/.npm/_logs/2018-11-09T23_58_11_085Z-debug.log

And inside that log I have:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'ng',
1 verbose cli   'new',
1 verbose cli   'my-app' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: ENOENT: no such file or directory, open '/home/<path>r/package.json'
5 verbose cwd /home/<path>
6 verbose Linux 4.15.0-38-generic
7 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "ng" "new" "my-app"
8 verbose node v10.13.0
9 verbose npm  v6.2.0
10 error path /home/<path>/package.json
11 error code ENOENT
12 error errno -2
13 error syscall open
14 error enoent ENOENT: no such file or directory, open '/home<path>/package.json'
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -2, true ]

I also tried doing "ng serve" on an existing project and it worked fine.

2

There are 2 answers

0
FlowYourMind On BEST ANSWER

Ok, it was my bad, in my .bashrc i redirected "ng" to "npm use ng".

Sorry and thank you all

2
m7md2112 On

try the code below in new empty dir.

npm uninstall -g @angular/cli
npm uninstall --save-dev @angular/cli
npm cache verify
npm install -g @angular/cli
ng v