【问题标题】:Can't install @types packages: Host key verification failed无法安装@types 包:主机密钥验证失败
【发布时间】:2017-03-19 20:38:14
【问题描述】:

当我尝试运行以下命令时:

npm install @types/react

我得到以下输出:

    npm ERR! git clone git@github.com:types/react Cloning into bare repository
'C:\Users\lifeg\AppDa
    ta\Roaming\npm-cache\_git-remotes\git-github-com-types-react-e0f5ee6a'...
    npm ERR! git clone git@github.com:types/react Host key verification failed.
    npm ERR! git clone git@github.com:types/react fatal: Could not read from remote repository.
    npm ERR! git clone git@github.com:types/react
    npm ERR! git clone git@github.com:types/react Please make sure you have the correct access right
    s
    npm ERR! git clone git@github.com:types/react and the repository exists.
    npm ERR! addLocal Could not install types/react
    npm ERR! Error: ENOENT: no such file or directory, stat 'C:\Users\lifeg\Documents\GitRepositorie
    s\Personal\ReactMarkdown\types\react'
    npm ERR!     at Error (native)
    npm ERR! If you need help, you may report this *entire* log,
    npm ERR! including the npm and node versions, at:
    npm ERR!     <http://github.com/npm/npm/issues>

    npm ERR! System Windows_NT 10.0.14393
    npm ERR! command "C:\\Program Files\\nodejs\\node.exe"
"C:\\ProgramData\\chocolatey\\lib\\npm\\t
    ools\\node_modules\\npm\\bin\\npm-cli.js" "install" "@types/react"
    npm ERR! cwd C:\Users\lifeg\Documents\GitRepositories\Personal\ReactMarkdown
    npm ERR! node -v v6.8.1
    npm ERR! npm -v 1.4.9
    npm ERR! path C:\Users\lifeg\Documents\GitRepositories\Personal\ReactMarkdown\types\react
    npm ERR! syscall stat
    npm ERR! code ENOENT
    npm ERR! errno -4058
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR!     C:\Users\lifeg\Documents\GitRepositories\Personal\ReactMarkdown\npm-debug.log
    npm ERR! not ok code 0

注意 Node/NPM 的版本:

npm ERR! node -v v6.8.1
npm ERR! npm -v 1.4.9

有关输出的某些内容表明该软件包未正确安装。

当我尝试安装其他 @types 软件包时,我得到了类似的结果,但像 react 这样的软件包安装正确。

我更新了NPM,更新前后出现同样的错误(输出是after)。

执行npm cache clean 什么也没做。

该错误似乎与 git 和 SSH 有关,即使 install 应该首先尝试通过 HTTPS 访问 git,但在这种情况下似乎不想这样做。

问题

基本上,我曾经尝试过一个名为 Chocolatey 的 Windows 包管理器,并用它来安装节点。

但是,我后来使用官方安装程序重新安装了 node 和 NPM。这两个装置并排存在,并引起了各种奇怪的副作用。

其中之一是当我运行npm install -g npm 时,它会使用chocolatey 附带的版本更新node 附带的NPM 版本。这导致我有一个过时的 NPM 版本,which is problematic when working with Git

【问题讨论】:

  • 检查您的npm 版本并尝试删除 npm 缓存
  • @Martin 我添加了 NPM 版本。我还清理了 NPM 缓存,但没有帮助。
  • 你真的很老npm。我什至不认为这是您的node 附带的npm。我有node v6.9.1 和npm 3.10.8。
  • @Martin Yikes。你说得对。我没有注意到。我很确定我知道是什么原因造成的。我想我的系统上有两个版本的 NPM。
  • 是的,我认为它会是这样的 :)

标签: node.js git typescript npm


【解决方案1】:

您的npm 非常旧,可能不是您的node 软件包随附的那个。

【讨论】:

    猜你喜欢
    • 2014-01-31
    • 1970-01-01
    • 2021-12-25
    • 2013-02-16
    • 1970-01-01
    • 1970-01-01
    • 2020-07-15
    • 2018-10-04
    • 2022-12-20
    相关资源
    最近更新 更多