首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular 2,从Github存储库安装库

Angular 2,从Github存储库安装库
EN

Stack Overflow用户
提问于 2017-03-15 05:13:00
回答 1查看 1.9K关注 0票数 1

我正在学习如何基于使用Angular-CLI创建的项目来创建一个Angular 2库。我以Nikita Smolenskii的ng-demo-libng-demo-app为例。

在package.json中,库依赖项如下所示:

代码语言:javascript
复制
"ng-demo-lib": "git+ssh://git@github.com/nsmolenskii/ng-demo-lib.git",

问题是,当我在ng-demo-app上运行npm install时,我得到:

代码语言:javascript
复制
npm ERR! git clone --template=/Users/xxx/.npm/_git-remotes/_templates --mirror ssh://git@github.com/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://git@github.com/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://git@github.com/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://git@github.com/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://git@github.com/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://git@github.com/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://git@github.com/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

我从未尝试过从package.json中的远程存储库导入。这对我来说是新的。有什么我需要设置好让Github知道我的身份吗?如何解决此权限问题?

EN

回答 1

Stack Overflow用户

发布于 2017-03-15 05:46:07

尝试像这样安装form github,或者在你的package.json文件中这样定义:

代码语言:javascript
复制
{
  "dependencies": {
    "repo-name": "github:user-name/repo-name"
  }
}

然后运行npm install

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42796653

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档