Git bash 不能 运行 任何 ng 命令(Angular CLI)

Git bash can not run any ng command (Angular CLI)

我正在研究 git bash cmd。当我尝试 运行 ng 命令时,例如ng serveng gc new-component 我看到了这个输出:

C:\Users\user\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

在输出的中间,我发现左右斜杠有问题。我该如何解决?

我想,这不是环境路径的问题,因为所有 ng 命令都在 Windows cmd 或 PowerShell 中运行。

请查看@steveswork 的评论: https://github.com/nodejs/node/issues/29287

您必须删除 C:/Users/user/AppData/Roaming/npm 和 C:/Users/user/AppData/Roaming/npm-缓存以及 重新安装全局 npm 模块。

(这通常发生在节点升级或降级之后)

祝你好运。