felix-last / npm-cygwin-patch

Patch to fix npm's git repository resolve under cygwin - credit goes to @mathieucarbou

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm on Cygwin

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.

How to Install

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:

  1. Download the file /lib/utils/git.js from this repository.
  2. Replace the file git.js in %APP_DATA%\npm\node_modules\npm\lib\utils\ with the downloaded file.

Background

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.

Issues?

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.

About

Patch to fix npm's git repository resolve under cygwin - credit goes to @mathieucarbou

License:Other


Languages

Language:JavaScript 97.1%Language:Shell 1.6%Language:CSS 0.5%Language:Makefile 0.4%Language:HTML 0.4%Language:Batchfile 0.1%