Ng'不被识别为内部或外部命令,可操作程序或批处理文件。 [英] Ng' is not recognized as an internal or external command, operable program or batch file.

查看:967
本文介绍了Ng'不被识别为内部或外部命令,可操作程序或批处理文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下链接成功地将Angular 4实现到我们的MVC4项目中并成功执行了角度欢迎页面。但是当我尝试使用 ng 命令创建新组件时,它说..

ng'不被识别为内部或外部命令,可操作程序或批处理文件。在命令提示符下。



Cli安装了全局包和我项目的本地包。

npm install -g @ angular / cli @ latest



npm install @ angular / cli @ latest



任何帮助将不胜感激

提前致谢

Soumya



我的尝试:



ASP.NET:Angular 2使用Visual Studio 2017快速入门 [ ^ ]



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

推荐答案

我使用以下链接解决了这个问题



[解决方案]

然后对本地包文件夹使用以下命令

npm install --save-dev @ angular / cli @ latest

现在ng命令正常工作!但是当我使用创建组件命令'ng gc newcomponent'



时它会显示错误'无法找到`.angular-cli.json'中的任何应用程序

请帮我这个
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


使用node js命令提示符而不是正常的命令提示符。它会起作用。
Use node js command prompt Instead of normal command prompt. It will work.


这篇关于Ng'不被识别为内部或外部命令,可操作程序或批处理文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆