2015-05-25 475 views
2

我在我的package.json中有3個私有依賴。當我運行npm安裝時,我得到錯誤。請注意,當我同DO克隆然後將其克隆ONLY NPM install不工作npm安裝的私有依賴不起作用,但是克隆不起作用

Cloning into bare repository 
Permission denied (publickey). 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights and the repository exists. 

整個日誌低於目前。

很少有類似的問題相關,但他們都沒有提供我的方案中的解決方案。最初我以爲是nodejs和npm版本問題,所以我通過運行windows nodejs.msi更新了它們,目前版本如圖所示。 enter image description here

我的package.json的內容是如下:(大部分被刪除,只是將重要的私人依賴被提及)

"dependencies": { 
    "private-dep2": "git+ssh://[email protected]:reph/private-dep2.git#v0.3.5" 
    }, 
    "devDependencies": { 
    "ember-cli": "0.2.5", 
    "ember-cli-app-version": "0.3.3",  
    "tough-cookie": "^0.12.1", 
    "private-dep3": "git+ssh://[email protected]:reph/private-dep3.git#v0.3.5", 
    "private-dep1": "git+ssh://[email protected]:reph/private-dep1.git#v0.7.5" 
    } 

整個日誌是如下:

PS C:\DDrive\Projects\p-ceck> npm cache clean 
PS C:\DDrive\Projects\p-ceck> 
PS C:\DDrive\Projects\p-ceck> 
PS C:\DDrive\Projects\p-ceck> bower cache clean 
PS C:\DDrive\Projects\p-ceck> 
PS C:\DDrive\Projects\p-ceck> 
PS C:\DDrive\Projects\p-ceck> 
PS C:\DDrive\Projects\p-ceck> npm install 
Enter passphrase for key '/c/Users/user_name/.ssh/id_rsa': Enter passphrase for key '/c/Users/user_name/.ssh/id_rsa': Enter passphrase for key|'/c/Users/user_name/.ssh/id_rsa': | 
/nter passphrase for key '/c/Users/user_name/.ssh/id_rsa':/
-nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': - 
/nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': \ 
|nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': - 
//ter passphrase for key '/c/Users/user_name/.ssh/id_rsa':/
-nter passphrase for key '/c/Users/user_name/.ssh/id_rsa': - 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496'... 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: Permission denied (publickey). 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: fatal: Could not read from remote repository. 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: Please make sure you have the correct access rights 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496: and the repository exists. 
/
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3'... 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: Permission denied (publickey). 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: fatal: Could not read from remote repository. 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: Please make sure you have the correct access rights 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep1.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep1-git-82b6a6b3: and the repository exists. 
/
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6'... 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: Permission denied (publickey). 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: fatal: Could not read from remote repository. 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: Please make sure you have the correct access rights 
npm ERR! git clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep2.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep2-git-426ffed6: and the repository exists. 

npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! node v0.12.4 
npm ERR! npm v2.10.1 
npm ERR! code 128 

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror ssh://[email protected]/reph/private-dep3.git C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496 
npm ERR! Cloning into bare repository 'C:\Users\user_name\AppData\Roaming\npm-cache\_git-remotes\ssh-git-github-comp-com-reph-private-dep3-git-bf7ad496'... 
npm ERR! Permission denied (publickey). 
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. 
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at: 
npm ERR!  <https://github.com/npm/npm/issues> 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\DDrive\Projects\p-ceck\npm-debug.log 

回答

1

對於已經有SSH密鑰設置了Github上的人,對我來說,解決辦法是通過輸入ssh -T [email protected]到我的終端來測試我的Github上的SSH帳戶。這促使我輸入了我輸入的密碼,現在NPM再次運行。如果您忘記了SSH密碼,您可以通過搜索ssh在Keychain Access工具中恢復它。