I wanted to update Angular, following the steps on this page:
How to upgrade Angular CLI to the latest version More precise this:
npm uninstall -g angular-cli
npm install -g @angular/cli@latest
But after doing that it doesn't recognize the ng variable in Cygwin , it recognizes it in the Windows own terminal and the Visual Studio Code terminal .
In Cywgin, after running:
ng v
I get the following:
C:\Users\admin\AppData\Roaming\npm/node_modules/node/bin/node: línea 1: This: no se encontró la orden
In that location, C:\Users\admin\AppData\Roaming\npm\node_modules\node\bin , there are two files: Name: node File type: file
Name: node.exe File Type: application
And I clarify that Angular was updated.
What I tried so far was the following:
I thought the problem was in the environment variables. Just in case, I added the following line:
C:\Users\admin\AppData\Roaming\npm\node_modules@angular\cli
But it still doesn't work. I assume those environment variables are for the windows terminal.
To fix problems like corrupted files.
You have to follow these steps:
1° Delete this folder
C:/Users/{username}/AppData/Roaming/npm
where the default modules are located.2° Delete the folder that hosts the cache
npm
located inC:/Users/{username}/AppData/Roaming/npm-cache
3° Install the angle again:
npm install -g @angular/cli
Remember that your
{username}
is your admin folder.You may just need to make an adjustment as shown in this example:
me@Laptop7:~ $ npm --version
6.4.1
me@Laptop7:~sudo npm uninstall -g angular-cli
me@Laptop7:~sudo npm install -g @angular/cli
Now just type
ng version
and that should solve your problem.In my case I fixed it by adding the npm folder to the environment variables list.
apparently my problem was that all the executables for the commands were in that folder.