-
Notifications
You must be signed in to change notification settings - Fork 209
Description
Sample project demonstrating the issue with steps to reproduce: https://github.com/kpage/gradle-node-plugin-git-bash-issue
The 'yarnSetup' task fails on Windows 10 when run in git bash due to node not being present on the PATH. Running yarnSetup in cmd.exe works fine. npmSetup and npmInstall both work on either git bash or cmd.exe.
Error is:
:yarnSetup
C:\Users\user\repo\gradle-node-plugin-git-bash-issue\.gradle\yarn\yarnpkg -> C:\Users\user\repo\gradle-node-plugin-git-bash-issue\.gradle\yarn\node_modules\yarn\bin\yarn.js
C:\Users\user\repo\gradle-node-plugin-git-bash-issue\.gradle\yarn\yarn -> C:\Users\user\repo\gradle-node-plugin-git-bash-issue\.gradle\yarn\node_modules\yarn\bin\yarn.js
> spawn-sync@1.0.15 postinstall C:\Users\user\repo\gradle-node-plugin-git-bash-issue\.gradle\yarn\node_modules\yarn\node_modules\spawn-sync
> node postinstall
'node' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\user\repo\gradle-node-plugin-git-bash-issue\.gradle\yarn
`-- (empty)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Users\\user\\repo\\gradle-node-plugin-git-bash-issue\\.gradle\\nodejs\\node-v6.9.1-win-x64\\node.exe" "C:\\Users\\user\\repo\\gradle-node-plugin-git-bash-issue\\.gradle\\nodejs\\node-v6.9.1-win-x64\\node_modules\\npm\\bin\\npm-cli.js" "install" "--prefix" "C:\\Users\\user\\repo\\gradle-node-plugin-git-bash-issue\\.gradle\\yarn" "yarn@0.17.10"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! spawn-sync@1.0.15 postinstall: `node postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spawn-sync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\user\repo\gradle-node-plugin-git-bash-issue\npm-debug.log
npm ERR! code 1
:yarnSetup FAILED
This command should use the node that is auto-downloaded by gradle-node-plugin. But the path is not correctly set in git bash. If you don't have node globally installed, you will see the error.
If you do have node globally installed, it will use the wrong version (not the version required by gradle-node-plugin). This can lead to errors as the wrong version of node can be used to create node_modules, and then the user will get errors when running commands that require node-specific versions of packages.