ng: command not found after installing node and angular cli - node.js

I just got a new clean MacOS Catalina installation, and I was trying to get my old project running using ng serve but it tells me that 'ng: command not found' I installed the npm 6.12.1 through nodeJS 12.13.1 installation as well, and ran 'npm install -g #angular/cli' and both ran without issues, then ran the npm i command for the stuff included in package.json in the same project directory, I googled around and one comment suggested using npm link #angular/cli which didn't differ as well

Try to restart your terminal after running npm install -g #angular/cli

Add npm global modules folder to your $PATH variable with the following command
export PATH="$HOME/.npm-packages/bin:$PATH"

Related

npm WARN deprecated #npmcli/move-file#2.0.1: This functionality has been moved to #npmcli/fs

While installing Angular cli using the command:
npm install -g #angular/cli
I am getting this warning.
I am using node version 16.17.0 and npm version 8.19.2
I wanted to install angular cli. But ng command not working
Try the command 'ng v' and check if it asks any question about sharing data about this project with the Angular Team at Google google or any question at all about google say N as no. If it shows angular versions then it means angular/cli is installed
To solve this problem perform following steps:
npm uninstall -g #angular/cli
npm cache clean --force
npm cache verify
npm install -g #angular/cli
ng version
After this moment if you see that powershell is not allowing to execute the script
follow following steps from this site:
Chaman Gautam
and then run ng version(or any ng command you will be able to)
if you see angular
you are good to go !!!
I had the same problem recently. I tried uninstalling angular and reinstalling it but there were already 'ng' files at the location:
C:/Users/<your_user_name>/AppData/Roaming/npm
To resolve the issue, go to that npm folder and delete the following files:
ng
ng.cmd
ng.ps1
Once these files are removed, reinstall angular cli. Follow the guide here to clear the cache and do a clean install:
[https://www.javatpoint.com/uninstall-and-reinstall-angular-cli][1]
The ng command should work now. Check with the below command
ng --version
References:
[1]: https://www.javatpoint.com/uninstall-and-reinstall-angular-cli

ng not found even if #angular/cli is global and located in environment variables

I have node.js version 16.14.2 and npm version 8.5.0 and also #angular/cli#13.3.0 I can verify that npm and node is working however #angular/cli that was installed globally can not be found using the ng command. I can also confirm that my environment variables are well set in place. But the main problem is that I still can't call the ng command.
P.S. pay no attention to ng#.0.0.0 I tried doing npm install -g ng
Uninstall "angular cli" and "ng".
Then run the command npm install -g #angular/cli

How to resolve this gulp watch issue [duplicate]

I am trying to start my angular app using grunt serve command
but I am getting Fatal error: spawn cmd ENOENT.
I used following commands to generate my Angular App
npm install -g yo grunt-cli bower
npm install -g generator-angular
yo angular
npm install
bower install
then i used grunt serve command to start my app
but its not working.
System Info:
OS: Windows 7 64 bit
npm version : 2.11.3
please help me, I gone through all the grunt documentation but no clue.
Try the following possible solutions:
Verify the npm folder exists at the following location C:\Users\My-UserName\AppData\Roaming\npm
Try to run npm cache clean
Add C:\Windows\System32\ to the PATH Environment variable
Run grunt serve with cmd.exe instead of git bash. I have the same problem and have dealt with it in this way.

angular cli install command showing errors

npm install -g #angular/cli
I am trying to install angular cli on Windows 10, I have already installed npm and node, and have verified their version, they are above then what is required for angular cli to install but when I run install command on the prompt it show error.
i have uninstalled npm and node, then reinstalled them, and tried again to install and it worked :) thanks
first try to see node and npm is installed successfully using following commands on cmd
node -v
for node and it will return the version of node,then
npm -v
then it will return the version of npm after that in windows go to environment variables and see node environmental varible is there. after that
npm cache clean --force
use to clean the cache and go to users/Appdata/roaming and delete all the node modules in npm cache folder and restart your computer and give the following command.
npm install -g #angular/cli

ng:command not found in node v6.9.1

I am trying to execute an ng command in angular-cli project in my windows 10 PC. node v6.9.1
Globally installed the angular-cli.
Tried a fresh npm install.
Tried adding the path
C:\Users\MohamadS\AppData\Roaming\npm\node_modules\angular-cli\bin
in uservariables in the path variable.
Still it says as in the picture.
Need help with the issue.
PS- can't use any of the ng commands.( ng g c /componentName/, ng build)
Edited -
Tried the same angular-cli version in the project folder for the global installation as well.
Checked whether npm path is added to system variable path,
I had the npm v4.0.2 and I simply did an npm install npm#latest -g
And once again installed angular-cli -g and now it's working.

Resources