gitgithubnpm

'Could not read from remote repository' on NPM install from GitHub public repo


I have problems installing some NPM packages. This happens when NPM package (angular2-materialize for example) is installed from the repo:

npm i InfomediaLtd/angular2-materialize

Also happens with its forks, too. I've tried to to create own forks with same results.

Installing it results in error,

 Error: Command failed: git -c core.longpaths=true clone --template=<...>\npm-cache\_git-remotes\_templates --mirror git@github.com:InfomediaLtd/angular2-materialize.git <...>\npm-cache\_git-remotes\git-github-com-InfomediaLtd-angular2-materialize-git-2ec1a411
 Cloning into bare repository '<...>\npm-cache\_git-remotes\git-github-com-InfomediaLtd-angular2-materialize-git-2ec1a411'...
 Host key verification failed.
 fatal: Could not read from remote repository.

 Please make sure you have the correct access rights
 and the repository exists.

The repo is public, it surely exists and can be cloned with

git clone git://github.com/InfomediaLtd/angular2-materialize.git

On the other hand, there's no error on this fork (repo name has been changed):

npm i thcheng/angular-plus-materialize

And other repos can be installed without problems as well:

npm i toddmotto/angular-component

I've tried this with all NPM versions on Windows, also tried this on Ubuntu server with same results. I run NPM as admin/root and tried to clean NPM cache (as relevant questions usually suggest).

Is there something wrong with this repo in particular? What is going on there and how can this be fixed?


Solution

  • The issue seems to be caused by the fact that there is no version field in package.json. While the fork that has no issue contains the field.

    This was apparently a bug that was fixed in NPM 5.x.