2017-03-14 3 views
1

Ich lerne, wie man eine Angular 2-Bibliothek basierend auf einem mit Angular-CLI erstellten Projekt erstellt. Ich gehe mit diesen Beispielen ng-demo-lib und ng-demo-app von Nikita Smolenskii.Angular 2, Bibliothek aus Github-Repository installieren

Die Bibliothek Abhängigkeit wird wie folgt in package.json aufgeführt:

"ng-demo-lib": "git+ssh://[email protected]/nsmolenskii/ng-demo-lib.git", 

Das Problem ist, wenn ich npm auf app ng-Demo-Installation ausgeführt erhalte ich:

npm ERR! git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://[email protected]/nsmolenskii/ng-demo-lib.git /Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b: Cloning into bare repository '/Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b'... 
npm ERR! git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://[email protected]/nsmolenskii/ng-demo-lib.git /Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b: Permission denied (publickey). 
npm ERR! git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://[email protected]/nsmolenskii/ng-demo-lib.git /Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b: fatal: Could not read from remote repository. 
npm ERR! git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://[email protected]/nsmolenskii/ng-demo-lib.git /Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b: 
npm ERR! git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://[email protected]/nsmolenskii/ng-demo-lib.git /Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b: Please make sure you have the correct access rights 
npm ERR! git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://[email protected]/nsmolenskii/ng-demo-lib.git /Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b: and the repository exists. 
npm ERR! Darwin 16.4.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" 
npm ERR! node v7.5.0 
npm ERR! npm v4.1.2 
npm ERR! code 128 

npm ERR! Command failed: git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://[email protected]/nsmolenskii/ng-demo-lib.git /Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b 
npm ERR! Cloning into bare repository '/Users/xxx/.npm/_git-remotes/git-ssh-git-github-com-nsmolenskii-ng-demo-lib-git-ea5cc26b'... 
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!  /Users/xxx/Desktop/nsmolenskii/ng-demo-app/npm-debug.log 

I‘ Es wurde nie versucht, aus einem Remote-Repository in package.json zu importieren. Das ist neu für mich. Muss ich etwas einrichten, damit Github meine Identität kennt? Wie behebe ich dieses Berechtigungsproblem?

Antwort

0

versuchen Form Github wie diese npm i -D github:user-name/repo-name installieren oder definieren, wie dies in Ihrer package.json Datei:

{ 
    "dependencies": { 
    "repo-name": "github:user-name/repo-name" 
    } 
} 

dann npm install laufen

+0

Das ist wirklich das Problem nicht lösen, da ich die Bibliothek benötigen von Paket.json zu installieren. – BBaysinger

+0

sehe meine aktualisierte Antwort. – zhimin

Verwandte Themen