无法安装@types软件包:主机密钥验证失败

时间:2016-11-06 12:25:51

标签: node.js git typescript npm

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

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,在更新之前和之后发生了同样的错误(输出在之后)。

执行npm cache clean没有做任何事。

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

问题

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

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

其中一个是当我运行npm install -g npm时,它将使用巧克力随附的版本更新节点附带的NPM版本。这导致我有一个过时的NPM版本,which is problematic when working with Git

1 个答案:

答案 0 :(得分:2)

您的npm已经很老了,可能不是node套餐附带的那个。

相关问题