【问题标题】:Git Bash does not work for npm, node, ng commands but all these commands works in powershell windows 10Git Bash 不适用于 npm、node、ng 命令,但所有这些命令都适用于 powershell windows 10
【发布时间】:2020-01-13 12:05:41
【问题描述】:

几个月前一切正常,但现在一些更新或某些东西破坏了我的 Angular 开发设置。 我得到了所有最新的节点、npm、ts、ng 和 VS 代码。过去工作得很好。 但是今天,几个月后我更新了所有内容,发现这些用于 ng 的命令在 Git BASH MING64 命令窗口中不起作用。 一切正常,在 windows cmd 和 powershell 中运行良好。 不过,我注意到 git Bash 窗口下的路径中有奇怪的正斜杠和反斜杠。 我的系统和当前用户的环境路径都设置好了。

RonPC@RON-DESKTOP MINGW64 ~/Documents/VScode-Projects/AngularProjects/angular2020/jan2020 (master)
$ ng --version
C:\Users\RonPC\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

RonPC@RON-DESKTOP MINGW64 ~/Documents/VScode-Projects/AngularProjects/angular2020/jan2020 (master)
$ npm ng --version
C:\Users\RonPC\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

RonPC@RON-DESKTOP MINGW64 ~/Documents/VScode-Projects/AngularProjects/angular2020/jan2020 (master)
$ npx ng --version
C:\Users\RonPC\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

RonPC@RON-DESKTOP MINGW64 ~/Documents/VScode-Projects/AngularProjects/angular2020/jan2020 (master)
$ node v
C:\Users\RonPC\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

RonPC@RON-DESKTOP MINGW64 ~/Documents/VScode-Projects/AngularProjects/angular2020/jan2020 (master)
$ node --version
C:\Users\RonPC\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

RonPC@RON-DESKTOP MINGW64 ~/Documents/VScode-Projects/AngularProjects/angular2020/jan2020 (master)

任何人都得到了修复它的提示。我尝试再次安装 git BASH 但没有帮助。 问候

Screenshot of path for system environment vars

Screenshot showing my installed components of node, npm and ng

【问题讨论】:

    标签: node.js bash git npm


    【解决方案1】:

    解决方案:

    在浏览了不同论坛上列出的众多解决方案后,重新安装 Nodejs/Git Bash cmd,修改 PATHS.. 没有运气。

    非常简单的解决方案:

    但我从添加删除程序中卸载了“节点”-> 从位置删除了文件夹“npm”和“npm-cache”--> C:\Users\RonPC\AppData\Roaming

    重新安装了 Node.js(随它一起安装了 npm),它就像魅力一样工作。

    希望它可以避免因这个原因而遇到麻烦的人。

    问候

    【讨论】:

    • 请注意,您应该添加npm install -g @angular/cli 以访问ng
    猜你喜欢
    • 2016-07-17
    • 2016-01-31
    • 1970-01-01
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 2011-03-28
    • 1970-01-01
    相关资源
    最近更新 更多