首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ng :术语“ng”不被识别为cmdlet的名称,函数Visual代码终端

ng :术语“ng”不被识别为cmdlet的名称,函数Visual代码终端
EN

Stack Overflow用户
提问于 2020-06-23 04:20:29
回答 11查看 74.9K关注 0票数 9

在VS代码中,当我运行命令ng build时,会出现错误

代码语言:javascript
运行
复制
PS D:\Dashboard\Test1> ng build
ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if   
a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ng build
+ ~~
    + CategoryInfo          : ObjectNotFound: (ng:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我在Path中添加了这些环境变量

代码语言:javascript
运行
复制
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
C:\Users\Avind\AppData\Local\Programs\Microsoft VS Code\bin;
C:\Users\Avind\AppData\Roaming\npm;

我怎样才能摆脱这个问题?

注意:我有node.jsC:\Program Files\nodejs。从命令提示符ng new project不工作,而是使用node.js命令。

编辑1:从VS代码终端执行npm install -g @angular/cli@latest后,出现在msg和ng cmd以下的不工作状态

代码语言:javascript
运行
复制
PS D:\Path\Test1> npm install -g @angular/cli@latest
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
C:\Users\Avind\AppData\Roaming\npm\ng -> C:\Users\Avind\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

> @angular/cli@9.1.9 postinstall C:\Users\AR20095474\AppData\Roaming\npm\node_modules\@angular\cli
> node ./bin/postinstall/script.js

+ @angular/cli@9.1.9
updated 1 package in 53.477s
EN

Stack Overflow用户

发布于 2022-03-08 12:25:40

我通过运行以下三个命令解决了这个问题:-

代码语言:javascript
运行
复制
npm uninstall -g @angular/cli angular-cli
npm cache clean or npm cache clean --force
npm install -g @angular/cli@latest

成功了。

票数 0
EN
查看全部 11 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62527278

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档