case-study : Installed angular-cli globally using (npm install -g angular-cli
) but when trying to create project using ng new my-project
it is throwing error:
ng: command not found
The issue is simple, npm
doesn’t know about ng
Just run npm link @angular/cli
and it should work seamlessly.
otherwise: we will have to rearrange (manualy) the PATHS to:
- NPM
- Nodejs
- Angular CLI
In System Environment Variables, the picture below shows the arrangement.
Then restart your system, and try the command again. It should work fine now 🙂
How to set global environment variables on Windows ?
Windows 7, 8,10
- Right click the Computer icon on your desktop and choose Properties from the menu.
- Click on the Advanced system settings link and then click Environment Variables. Under the section System Variables, select the environment variable you want to edit, and click Edit.
- If the environment variable you want doesn’t exist, click New.
- Input the value of the environment variable in the Edit System Variable (or New System Variable) window, and click OK.