Search code examples
npmyarnpkgnpm-scriptsnpm-run

Yarn run command fail but npm run works


When I try to run yarn run command in a project I'm getting below error in git-bash.

/d: /d: Is a directory

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

However if I run it using npm run it works fine. Repo to reproduce the error - https://github.com/shabith/yarn-run-bug

Environment - Windows 10, git-bash

Things that I have already tried:

  1. Reinstall Node.js
  2. Reinstall Yarn

enter image description here


Solution

  • Finally found a fix to this issue.

    All I had to do is delete my npm shell-script using npm config delete script-shell and it start working.

    More info can be found on the bug that I have raised in github - https://github.com/yarnpkg/yarn/issues/6086#issuecomment-423361321