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

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

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 

请注意节点/ NPM的版本:

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

输出的某些内容表明软件包安装不正确。

当我尝试安装其他@types软件包时,得到了类似的结果,但是正确地安装了软件包等。

我更新了NPM,在更新之前和之后发生了相同的错误(输出在之后)。

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

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

问题

基本上,有一次我尝试了一个叫做Chocolatey的Windows包pipe理器,并用它来安装节点。

不过,我后来使用官方安装程序重新安装了节点和NPM。 这两个装置并排存在,造成了各种不同的副作用。

其中之一就是当我运行npm install -g npm ,它会使用巧克力附带的版本更新节点附带的NPM版本。 这导致我有一个过时的NPM版本,这在使用Git时是有问题的

你的npm很老了,可能不是你的node包所附带的。