npm install 尝试从随机 fork 安装

npm install trying to install from random fork

我有一个在 mac 上运行良好的节点项目,但是在 windows 上,当我在家里尝试执行 npm install 时,它给我一个访问权限错误。

在我的 package.json 我有这个

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

它给了我这个错误

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.

似乎正在尝试从异步分支安装。我不明白。

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

我尝试了 npm clean cache 但没有成功。

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.

如果您不想在 Windows 上安装 Git,您可以按照以下步骤进行操作:
npm_on_cygwin
它涉及一个 patched git.js, which will properly managed Windows path,而不是像 /cygdrive/c/.../C:\Users\....

那样盲目地连接它

OP Devilwarriors mentions the npm issue 12821,类似问题的双Git设置:

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.