无法将"ng"识别为内部或外部命令, [英] 'ng' is not recognized as an internal or external command,
问题描述
我刚刚开始使用CLI,当我尝试安装@ angular/cli并运行代码ng --help
I have just started to work with the CLI and when i tried to install the @angular/cli and run the code ng --help
我遇到以下错误
'ng'不被识别为内部或外部命令,
'ng' is not recognized as an internal or external command,
我浏览了所有博客,但按照博客中列出的所有步骤进行操作后却找不到任何帮助
I have gone through all the blogs and didn't find any help after following all the procedures listed in the blogs
- 我更改了
用户变量路径:; C:\ Program Files \ nodejs \和系统变量: C:\ Program Files \ nodejs \ ;%AppData%\ npm ;;
user variables path : ;C:\Program Files\nodejs\ and system variable : C:\Program Files\nodejs\ ;%AppData%\npm;;
-
当我运行命令
when i ran the command
npm install -g @ angular/cli
npm install -g @angular/cli
我在node_modules文件夹下找到了以下文件
i found the following files under node_modules folder
@角度
-cli
--- bin
----- ng
cli
我尝试使用清理缓存
npm cache clean
然后运行代码
ng --version
但是我遇到了标题中提到的错误
but i am getting the error as mentioned in the title
推荐答案
我已经搜索了很长时间,但是没有找到解决方案.您必须执行以下步骤:
I have searched long but didn't found the solution. You have to follow these steps:
- 全局安装angular/cli
- 安装完成后,立即在终端上复制同时显示的路径
- 将该路径粘贴到PATH环境变量中
- 重新启动终端会有所帮助
在...之后
npm install -g @angular/cli@latest
此路径显示为
C:\ Users \ rizwan.local \ share \ npm
C:\Users\rizwan.local\share\npm
复制路径并将其粘贴到 环境变量 像
copy the path and paste it into Environment variable like
保存并运行ng -v
享受
这篇关于无法将"ng"识别为内部或外部命令,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!