When running npm install
with the git binary delivered by cygwin (included in babun), npm does not properly resolve package dependencies to git repositories. This patch fixes npm's behavior in this case.
After updating npm (npm install npm@latest -g
), simply run
cp $APPDATA/npm/node_modules/npm/lib/utils/git.js $APPDATA/npm/node_modules/npm/lib/utils/git.unpatched.js
curl https://raw.githubusercontent.com/felix-last/npm-cygwin-patch/master/lib/utils/git.js > $APPDATA/npm/node_modules/npm/lib/utils/git.js
Mind that updating npm requires you to reapply the patch.
Alternatively, copy the file manually:
- Download the file
/lib/utils/git.js
from this repository. - Replace the file
git.js
in%APP_DATA%\npm\node_modules\npm\lib\utils\
with the downloaded file.
This patch is based on a pull request to npm which has not been accepted, as npm does not officially support cygwin.
I changed the way the patch was implemented so that it can be easily rebased on top of new npm versions, making it easy to keep the patch up-to-date. I will try to frequently fetch from the upstream, but please feel free to remind me by opening an issue if this becomes outdated.
If this doesn't work for you, maybe this guide can help you. You can always reset the patched file git.js
in the folder %APP_DATA%\npm\node_modules\npm\lib\utils
to the original file realeased by npm - it should be in your folder named git.unpatched.js
.