GregRos GregRos - 28 days ago 13
Git Question

Can't install @types packages: Host key verification failed

When I try to run the following command:

npm install @types/react


I get the following output:

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


Note the versions of Node/NPM:

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


Something about the output suggests that the package was not installed correctly.

I get similar results when I try to install other
@types
packages, but packages like
react
install properly.

I updated NPM and the same error occurred before and after the update (the output is after).

Performing
npm cache clean
did nothing.

The error seems to be related to git and SSH, even though
install
is supposed to try accessing git through HTTPS first, it doesn't seem to want to do that in this case.

The problem



Basically, at one time I had experimented with a Windows package manager called Chocolatey and used it to install node.

However, I later re-installed node and NPM using the official installer. The two installations existed side-by-side and caused a variety of strange side-effects.

One of them was that when I ran
npm install -g npm
and it would update the version of NPM that came with node using the version that came with chocolatey. This caused me to have an outdated version of NPM, which which is problematic when working with Git

Answer

Your npm is very old and it's probably not the one that comes with your node package.

Comments