Cannot Install NPM Package - Code 128 An unknown git error occurred
Asked Answered
I

4

10

I'm trying to install the package @truffle/hdwallet-provider .

As written in the doc, I'm running:

npm i @truffle/hdwallet-provider

Here is the error message I'm getting:

npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/ethereumjs/ethereumjs-abi.git
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-03-08T14_13_15_122Z-debug-0.log

Here are the logs:

698 verbose Linux 5.13.0-30-generic
699 verbose argv "/usr/bin/node" "/usr/bin/npm" "i" "@truffle/hdwallet-provider"
700 verbose node v14.17.6
701 verbose npm  v8.5.3
702 error code 128
703 error An unknown git error occurred
704 error command git --no-replace-objects ls-remote ssh://[email protected]/ethereumjs/ethereumjs-abi.git
705 error [email protected]: Permission denied (publickey).
705 error fatal: Could not read from remote repository.
705 error
705 error Please make sure you have the correct access rights
705 error and the repository exists.
706 verbose exit 128
707 timing npm Completed in 6266ms
708 verbose unfinished npm timer reify 1646748520075
709 verbose unfinished npm timer reify:loadTrees 1646748520084
710 verbose code 128
711 error A complete log of this run can be found in:
711 error     /root/.npm/_logs/2022-03-08T14_08_39_958Z-debug-0.log

My node version:

v14.17.6

My NPM version:

v8.5.3
Illustrate answered 8/3, 2022 at 14:15 Comment(0)
I
3

Actually, it's a well-known bug. https://github.com/trufflesuite/truffle/issues/2852

Using this solved the problem:

npm i @truffle/hdwallet-provider@next
Illustrate answered 8/3, 2022 at 14:23 Comment(0)
B
2

For other people coming here for the same bug with another package, check this SO post:

npm install error code 128

Barrios answered 22/8, 2022 at 22:11 Comment(0)
L
1

Try npm config set legacy-peer-deps true, that worked for me.

Lesley answered 18/11, 2022 at 6:58 Comment(0)
V
-1

Step 1: Generate a New SSH Key Pair

Open your terminal.

Run the following command to generate a new SSH key pair: ssh-keygen -t rsa -b 4096 -C "[email protected]"

Replace "[email protected]" with your actual email address.

When prompted to "Enter a file in which to save the key," press Enter to accept the default location (/c/Users/rosha/.ssh/id_rsa on Windows). When prompted to "Enter passphrase (empty for no passphrase)," press Enter if you do not want a passphrase, or enter a secure passphrase if you want additional security.

Step 2: Add Your SSH Key to the SSH Agent

Start the SSH agent in the background: eval "$(ssh-agent -s)"

Add your SSH private key to the SSH agent: ssh-add ~/.ssh/id_rsa

Step 3: Add Your SSH Key to Your GitHub Account

Copy the SSH public key to your clipboard: cat ~/.ssh/id_rsa.pub Select and copy the entire output.

Follow these steps on GitHub: Log in to your GitHub account. In the upper-right corner of any page, click your profile photo, then click Settings. In the user settings sidebar, click SSH and GPG keys. Click New SSH key. In the "Title" field, add a descriptive label for the new key (e.g., "My Laptop Key"). Paste your key into the "Key" field. Click Add SSH key. Confirm your GitHub password if prompted.

Step 4: Test Your SSH Connection

To verify that your SSH key is correctly added and working, run: ssh -T [email protected]

You should see a message like this: Hi username! You've successfully authenticated, but GitHub does not provide shell access.

if you don't get, prefer this youtube video: https://youtu.be/aHcflUMfCp8?si=D4mfkx78BP9t_bY1

Vesiculate answered 14/6 at 7:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.