Git bash 无法运行任何 ng 命令(Angular CLI)

Paw*_*wel 4 bash git-bash angular-cli

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

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

在输出中间,我看到左右斜线有问题。我该如何解决?

我想,环境路径没有问题,因为所有 ng 命令都在 Windows cmd 或 PowerShell 中工作。

Mam*_*mun 5

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

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

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

祝你好运。