WebStorm 摩卡测试 'sh' 不被识别为内部或外部命令



我正在尝试为我的节点运行摩卡测试.js代码,该代码运行以下行:

exec(`sh ${scriptFile}`);

当我使用npm test从命令行 (Git Bash( 运行它时,它会通过。但是,当我从WebStorm运行它时,出现以下错误:

'sh' is not recognized as an internal or external command,
operable program or batch file.

我觉得我可能错过了一些 WebStorm 设置,但我无法弄清楚它是什么。有什么想法吗?

附言我在窗户上。

对于那些在Windows上使用phpStorm并通过Google来到这里的人

在您的计算机上安装 Git。转到"Settings/Terminal"并将"shell path"设置为"C:Program FilesGitbinsh.exe

还要在环境变量中向 PATH 添加C:Program FilesGitbin

Git Bash 实现了一个模拟 bash 的 *nix 式 shell,它可以解析你的命令。Webstorm似乎试图在不支持sh语法的powershell或cmd中执行您的命令。

打开"设置/首选项"对话框的"终端"页面,然后按如下方式配置 Shell 路径字段:

"[path to the git installation]binsh.exe" -login -i

这可能是"C:Program FilesGitbinsh.exe" -login -i

来源: https://www.jetbrains.com/help/webstorm/2017.1/working-with-embedded-local-terminal.html

相关内容

最新更新