Search code examples
node.jswindowsgitnpmbabun

npm install trying to install from random fork


I got a node project that work fine at work on mac, but on windows at home it give me a access right error when I try to do npm install.

in my package.json I have this

"dependencies": {
  "async": "2.1.4"
}

and it give me this error

npm ERR! Command failed: git -c core.longpaths=true clone C:\Users\username\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jstewmon-async-git-e757f9b4 C:\Users\username\.babun\cygwin\tmp\npm-17984-bd5d3a5c\git-cache-52562eee\c6a89a49b0d525c41545e8afd9a4fe844033cc52
npm ERR! Cloning into 'C:\Users\username\.babun\cygwin\tmp\npm-17984-bd5d3a5c\git-cache-52562eee\c6a89a49b0d525c41545e8afd9a4fe844033cc52'...
npm ERR! fatal: '/cygdrive/c/Users/username/AppData/Roaming/npm-cache/_git-remotes/git-github-com-jstewmon-async-git-e757f9b4/C:\Users\username\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jstewmon-async-git-e757f9b4' does not appear to be a git repository
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

seem to be trying to install from a fork of async.. I don't get it.

git-github-com-jstewmon-async-git-e757f9b4 https://github.com/jstewmon/async

I tried npm clean cache with no success.


Solution

  • As mentioned in npm issue 7456

    I can confirm that this command fails "does not appear to be a git repository" when using the current git bundled with Cygwin (2.4.5) 64 bit.

    When I separately download and install the Windows git distribution (2.6.2.windows.1) (now 2017 2.12.0), and put the GIT_HOME in front of the CYGWIN_HOME in the PATH, the npm install (including the git clone) succeeds.
    I installed with the mintty option so that git works properly with docker also.

    If you don't want to install Git on Windows, you can instead follow:
    "npm_on_cygwin"
    It involved a patched git.js, which will properly managed Windows path, instead of blindly concatenate it as in /cygdrive/c/.../C:\Users\....

    The OP Devilwarriors mentions in the comments the npm issue 12821, a similar problem of double Git installed:

    babun's sandboxed git can't download git repos when used through npm.
    To solve this, you can uninstall babun's git with pact remove git and use the Git for Windows that you already have installed.