2013-05-07 17 views
19

ich eine Abhängigkeit festlegen möchten, die ein Git-URL eines privaten Paket in package.json ist schreibe ich:NPM installieren: Git URL Abhängigkeitsfehler in package.json

"dependencies" : { 
    "mymodule" : "git://[email protected]:/myproject#mybranch" 
} 

Wenn npm install läuft ich diesen Fehler :

git clone git://[email protected]:/myproject.git Cloning into bare repository '/hom 
/Ostro/.npm/_git-remotes/git-git-myrepo-com-myproject-git-4d838f3d'... 
npm ERR! git clone git://git.myrepo.com:/myproject.git 
npm ERR! git clone git://git.myrepo.com:/myproject.git fatal: Unable to look up 
git.myrepo.com (port) (Servname() not supported for ai_socktype) 
npm ERR! Error: git "clone" "--mirror" "git://git.myrepo.com:/myproject.git" "/hom 
/Ostro/.npm/_git-remotes/git-git-myrepo-com-myproject-git-4d838f3d" failed with 128 
npm ERR! at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/exec.js:56:20) 
npm ERR! at ChildProcess.EventEmitter.emit (events.js:99:17) 
npm ERR! at maybeClose (child_process.js:638:16) 
npm ERR! at Socket.ChildProcess.spawn.stdin (child_process.js:815:11) 
npm ERR! at Socket.EventEmitter.emit (events.js:96:17) 
npm ERR! at Socket._destroy.destroyed (net.js:358:10) 
npm ERR! at process.startup.processNextTick.process._tickCallback (node.js:245:9) 

Aber es sieht aus wie npm Anruf git clone --mirror git://git.myrepo.com ...etc es nicht git clone --mirror git.myrepo.com ...etc annehmen, anstatt zu nennen?

Ist jemand schon damit konfrontiert? oder hast du eine Ahnung?

+0

Git URL in Ihrem 'package.json' ist antipattern! – hellboy

Antwort

41

Die gültigen Formulare sind unten aufgeführt. Wenn Sie username @ verwenden, müssen Sie entweder ssh oder https angeben. Außerdem bin ich nicht sicher, ob:/ist gültig, wenn Sie kein Konto verwenden.

git://github.com/user/project.git#commit-ish 
git+ssh://[email protected]:project.git#commit-ish 
git+ssh://[email protected]/project.git#commit-ish 
git+http://[email protected]/project/blah.git#commit-ish 
git+https://[email protected]/project/blah.git#commit-ish 
+0

thx es das Problem beheben – Ostro

+0

Wenn Sie eine private REPO verwenden, verbinden Sie es einfach nach dem gleichen Muster: zum Beispiel gab ich ein NPM-Modul Gabeln und auf einem privaten Atlessian Stash-Server in einem privaten Git Repo geschoben ... Meine Abhängigkeit war die Folgendes: "crafity": "git + https: //repos.xxx.com/scm/project-a/isp-npm-module-loggin.git#HEAD" –

Verwandte Themen