【问题标题】:Angular cli installation yields ssh errorAngular cli 安装产生 ssh 错误
【发布时间】:2018-03-22 03:56:51
【问题描述】:

安装 Angular cli:

npm -g install angular/cli

使用节点 8.6 产生此错误:

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/angular/cli.git
npm ERR! 
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! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2017-10-10T16_41_49_141Z-debug.log

更改为节点版本 6.11.4 会产生类似错误:

npm ERR! git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Cloning into bare repository '/Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032'...
npm ERR! git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Warning: Permanently added the RSA host key for IP address '64:ff9b::c01e:fd71' to the list of known hosts.
npm ERR! git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Permission denied (publickey).
npm ERR! git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: fatal: Could not read from remote repository.
npm ERR! git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: 
npm ERR! git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: Please make sure you have the correct access rights
npm ERR! git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032: and the repository exists.
npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/user/.nvm/versions/node/v6.11.4/bin/node" "/Users/user/.nvm/versions/node/v6.11.4/bin/npm" "install" "-g" "angular/cli"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! code 128

npm ERR! Command failed: git clone --template=/Users/user/.npm/_git-remotes/_templates --mirror git@github.com:angular/cli.git /Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032
npm ERR! Cloning into bare repository '/Users/user/.npm/_git-remotes/git-github-com-angular-cli-git-05516032'...
npm ERR! Warning: Permanently added the RSA host key for IP address '64:ff9b::c01e:fd71' to the list of known hosts.
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/user/npm-debug.log

这发生在我的 Ubuntu 远程服务器和本地 MacBook 上,它们都将有效的 SSH 密钥添加到我的 Github 帐户中。

【问题讨论】:

    标签: node.js ssh angular-cli


    【解决方案1】:

    它应该是 @angular/cli,因为 angular/cli 是一个不存在的 npm 包:

    npm -g install @angular/cli

    【讨论】:

      【解决方案2】:

      正确的命令是: npm install -g @angular/cli 您可以检查此项以启动您的应用程序: https://angular.io/guide/quickstart

      【讨论】:

        猜你喜欢
        • 2018-01-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-29
        • 2017-08-13
        • 1970-01-01
        • 1970-01-01
        • 2018-07-06
        相关资源
        最近更新 更多