简体   繁体   中英

how to get packages from git using node's npm

I have cloned a project from the git repository, and I'm using npm install to install packages. The packages include some modules from the git repository. However, the "npm install" fails with the following message:

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 ]

I have taken the clone from the trunk, ie "master" branch.

package.json has the following entry:

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

Does anybody have any clue about what is wrong here? There is no revision or branch name as far as I'm aware. (I tried using "test.git#master" but got the same error)

I had the same problem. What happened in my case was that I tried to access the git repository before I had proper access and it tried to cache the repository. when I tried to install the repository again using npm I got the above error.

I went to the npm-cache for the repository and deleted the repository folder.

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

find the folder with the name of your repository and delete it. then try to install via NPM again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM