Yarn 运行 命令失败但 npm 运行 有效

Yarn run command fail but npm run works

当我尝试在项目中使用 运行 yarn run 命令时,我在 git-bash.

中遇到以下错误

/d: /d: Is a directory

?[2K?[1G?[31merror?[39m Command failed with exit code 126.

然而,如果我 运行 它使用 npm run 它工作正常。 重现错误的回购 - https://github.com/shabith/yarn-run-bug

环境 - Windows10,git-bash

我已经尝试过的事情:

  1. 重新安装Node.js
  2. 重新安装 Yarn

终于找到了解决这个问题的方法。

我所要做的就是使用 npm config delete script-shell 删除我的 npm shell-script 然后它开始工作。

有关我在 github - https://github.com/yarnpkg/yarn/issues/6086#issuecomment-423361321

中提出的错误的更多信息