node.jsgitnpm

Node.js Conflicts With Git on Windows 10


I have Node and Git installed on Windows 10, I got "npm error code 128" while installing @google/genai.

On another Windows 10 machine without Git installed, The same command successfully installed the library.

Here's the full error message:

npm error code 128
npm error An unknown git error occurred
npm error command git --no-replace-objects ls-remote ssh://git@github.com/google/genai.git
npm error remote: Repository not found.
npm error fatal: repository 'https://github.com/google/genai.git/' not found

I tried to access URL "github.com/google/genai.git" but it doesn't exist.

I tried to ask ChatGPT and one of responses is that Node uses the Git SSH by default and the solution is to switch to use "github.com" instead of "git@github.com" with the following commands:

git config --global url."https://github.com/".insteadOf "git@github.com:"
git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"

I tried them but nothing help, The same error appears.

I tried to uninstall Node.js and remove its dirs completely and Git as well and reinstall them, But nothing help.

I tried to uninstall Git only and got this error:

npm error code ENOENT
npm error syscall spawn git
npm error path git
npm error errno -4058
npm error enoent An unknown git error occurred
npm error enoent This is related to npm not being able to find a file.
npm error enoent

Solution

  • Found a hidden "undefined" key under "dependencies" key was added for unknown reasons confuse me and the AI helper

    "dependencies": {
        "undefined": "google/genai"
    }
    

    After removing it, The npm install back to work.

    Hope it help others.