yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Yarn fails to install (Exit code: 128)

Open thenameisajay opened this issue 1 year ago • 1 comments

Issue Title: Unable to fetch packages from remote repository during yarn install

Description: Firstly, thank you for the amazing work on this project. When attempting to run yarn install in the project directory, the process fails to fetch packages from a remote repository with the following error message:

yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://[email protected]/googleapis/nodejs-vertexai.git
Directory: /vercel/path0
Output:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Behavior: The yarn install command should successfully resolve and fetch packages from the remote repository without any errors.

Seen behaviour : Works on local but on production it fails to fetch the package

Environment:

  • Operating System: [macOS Ventura]
  • Yarn version: [e.g., 1.22.19]

thenameisajay avatar Apr 01 '24 13:04 thenameisajay

Host key verification failed means that you have an entry in your $HOME/.ssh/known_hosts file that doesn't match what github.com is returning.

Here's a post on how you can fix it https://serverfault.com/questions/321167/add-correct-host-key-in-known-hosts-multiple-ssh-host-keys-per-hostname.

TLDR: Add the correct key returned by

 ssh-keyscan -t rsa github.com

to your known_hosts file

Edit: It's also worth noting that if you have strict host checking enabled that openssh 7.6 added the StrictHostKeyChecking=accept-new config option.

clintmod avatar Sep 17 '24 15:09 clintmod