【问题标题】:how to get packages from git using node's npm如何使用 node 的 npm 从 git 获取包
【发布时间】:2014-08-13 08:19:07
【问题描述】:

我从 git 存储库中克隆了一个项目,我正在使用 npm install 来安装包。这些包包括来自 git 存储库的一些模块。但是,“npm install”失败并显示以下消息:

15 error Failed resolving git HEAD (git@github.com:tinc/test.git) fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
15 error Failed resolving git HEAD (git@github.com:tinc/test.git) Use '--' to separate paths from revisions, like this:
15 error Failed resolving git HEAD (git@github.com:tinc/test.git) 'git <command> [<revision>...] -- [<file>...]'
.
.
18 error Error: Command failed: fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
18 error Use '--' to separate paths from revisions, like this:
18 error 'git <command> [<revision>...] -- [<file>...]'
18 error
18 error     at ChildProcess.exithandler (child_process.js:648:15)
18 error     at ChildProcess.emit (events.js:98:17)
18 error     at maybeClose (child_process.js:756:16)
18 error     at Process.ChildProcess._handle.onexit (child_process.js:823:5)
19 error If you need help, you may report this *entire* log,
19 error including the npm and node versions, at:
19 error     <http://github.com/npm/npm/issues>
20 error System Windows_NT 6.1.7601
21 error command "C:\\apps\\node\\\\node.exe"     "C:\\apps\\node\\node_modules\\npm\\bin\\npm-    cli.js" "install"     "git+ssh://git@github.com:tinc/test.git"
22 error cwd C:\apps\git\test
23 error node -v v0.10.30
24 error npm -v 1.4.9
25 error code 128
26 verbose exit [ 1, true ]

我已经从主干中获取了克隆,即“master”分支。

package.json 有以下条目:

"test": "git+ssh://git@github.com:tinc/test.git"

有人知道这里出了什么问题吗? 据我所知,没有修订或分支名称。 (我尝试使用“test.git#master”但得到了同样的错误)

【问题讨论】:

    标签: node.js git


    【解决方案1】:

    我遇到了同样的问题。 在我的情况下发生的事情是,我在获得适当访问权限之前尝试访问 git 存储库,并且它试图缓存存储库。当我尝试使用 npm 再次安装存储库时,出现上述错误。

    我去了存储库的 npm-cache 并删除了存储库文件夹。

    C:\Users\your_user\AppData\Roaming\npm-cache\_git-remotes\

    找到您的存储库名称的文件夹并将其删除。 然后尝试再次通过 NPM 安装。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-20
      • 1970-01-01
      • 2017-05-31
      • 2021-03-27
      • 2020-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多