2013-05-07 11 views
19

でGitのURL依存エラー:NPMインストール:私は私が書くpackage.jsonの民間パッケージのGitのURLで依存関係を設定したいpackage.json

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

npm installを実行しているとき、私はこのエラーを取得します:

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) 

しかし、それは代わりにgit clone --mirror git.myrepo.com ...etcを呼び出すと仮定しません、それはNPMコールgit clone --mirror git://git.myrepo.com ...etc のように見えますか?

誰かがすでにそれに直面していますか?または何か手掛かりがありますか?

+0

あなたの 'package.json'のGit URLは反パターンです! – hellboy

答えて

41

有効なフォームは以下のとおりです。 username @を使用している場合は、sshまたはhttpsのいずれかを指定する必要があります。また、私は:/あなたがアカウントを使用していない場合は有効ですかわからない。

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それは問題を解決します – Ostro

+0

プライベートREPOを使用する場合は、同じパターンに従って接続します。たとえば、NPMモジュールをフォークし、プライベートgitリポジトリ内のプライベートAtlessian Stashサーバーにプッシュしました。次のようになります: "crafity": "git + https://repos.xxx.com/scm/project-a/isp-npm-module-loggin.git#HEAD" –

関連する問題