0

在此处输入图像描述

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 并重新安装了它们,但它仍然无法正常工作。

4

1 回答 1

0

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

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

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

于 2022-01-12T22:30:08.950 回答