GregRos GregRos - 1 year ago 204
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 Cloning into bare repository
npm ERR! git clone Host key verification failed.
npm ERR! git clone fatal: Could not read from remote repository.
npm ERR! git clone
npm ERR! git clone Please make sure you have the correct access right
npm ERR! git clone 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
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! <>

npm ERR! System Windows_NT 10.0.14393
npm ERR! command "C:\\Program Files\\nodejs\\node.exe"
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
packages, but packages like
install properly.

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

npm cache clean
did nothing.

The error seems to be related to git and SSH, even though
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 Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download