【问题标题】:'ng' is not recognized after remove and reinstall删除并重新安装后无法识别“ng”
【发布时间】:2022-01-12 22:21:45
【问题描述】:

npm -g list command I can see installed Angular globally but when I run the ng --version it is giving   
this error 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 --version
+ ~~
    + CategoryInfo          : ObjectNotFound: (ng:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我已经从我的电脑中删除了 node 和 npm 并重新安装了它们,但它仍然无法正常工作。

【问题讨论】:

  • 我也更新了环境变量

标签: angular npm angular13 npm-cache


【解决方案1】:

我认为您需要检查 npm 包的版本。您输入的内容意味着您要求它通过在计算机上运行作为程序安装的 Angular 来检查版本,而不是 npm 包。你想要的命令是npm list ng --depth=0。这为您提供了使用 npm 安装的版本。它将它从您正在使用的列表命令中删除。

https://nodejs.dev/learn/find-the-installed-version-of-an-npm-package

如果您希望能够从命令行使用 angular,您还需要安装 angular-cli。

【讨论】:

  • 感谢您的帮助,我已经运行了 npm list ng --depth=0 命令,它向我显示了“User@ C:\Users\User `-- (empty)”
猜你喜欢
  • 2021-08-06
  • 1970-01-01
  • 2019-09-09
  • 1970-01-01
  • 1970-01-01
  • 2017-07-11
  • 2017-09-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多