Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have successfully implemented Angular 4 in to our MVC4 project using the following link and got successfully executed the angular welcome page. But when I try to create new component using ng command it says..
ng' is not recognised as an internal or external command, operable program or batch file. in command prompt.

Cli installed both the global package and my project's local package.
npm install -g @angular/cli@latest
and
npm install @angular/cli@latest

Any help will be appreciated
Thanks in advance
Soumya

What I have tried:

ASP.NET: Angular 2 Quickstart with Visual Studio 2017[^]

C:\Windows\system32>npm -v
5.6.0

C:\Windows\system32>node -v
v8.11.1
Posted
Updated 9-Aug-20 18:20pm

I solved myself for this problem using the below link

[Solution]
then use the following command for the local package folder
"npm install --save-dev @angular/cli@latest"
Now ng command is working! but when I use the create component command 'ng g c newcomponent'

it says the error 'Unable to find any apps in `.angular-cli.json'
Please help me on this
 
Share this answer
 
v2
Comments
soumyaraj 11-Apr-18 6:04am    
The above issue also solved using the guidlines from below link

https://stackoverflow.com/questions/46826352/angular-cli-in-asp-net-core-2-angular-template
Use node js command prompt Instead of normal command prompt. It will work.
 
Share this answer
 
After execution of the npm -g @angular/cli command

go to path : C:\Users\<UserName>\AppData\Roaming\npm

There you can find the ng script file (type .cmd )

Copy the path

Move on to Environment Variables
1) Right click of This PC
2) Advance System Settings
3) Click Environment Variables button which is at the bottom

Click on NEW or you can EDIT your existing PATH

Variable Name: PATH
Variable Value: C:\Users\<UserName>\AppData\Roaming\npm

Click ok and your Environment Variable path is setted

Now restart your Command prompt

Type ng --version

You can find your installed version of angular/cli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900