#npm error code ENOENTnpm error syscall spawn gitnpm error path gitnpm error errno -4058npm error

1 messages · Page 1 of 1 (latest)

acoustic wren
#

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
npm error A complete log of this run can be found in: C:\Users\asus\AppData\Local\npm-cache_logs\2026-03-10T06_29_27_430Z-debug-0.log

worldly spokeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

bitter sentinelBOT
#

That error means npm tried to run git, but Windows can’t find the git executable (so spawning git fails with ENOENT). This usually happens when a dependency is pulled from GitHub / a git+https://... URL.

Fix on Windows:

  1. Verify git is actually available
git --version
where git

If those fail → Git isn’t installed or isn’t on your PATH.

  1. Install Git for Windows (or add it to PATH)

Or via winget:

#
winget install --id Git.Git -e
  1. Restart your terminal / VS Code (PATH changes won’t show up in already-open shells)

  2. Re-run your npm install / pnpm install.

If git --version works but npm still errors, paste:

  • the exact command you ran
  • the package.json line that references a git dependency (or tell me what project you’re installing)
acoustic wren
#

It doesn’t work.

bitter sentinelBOT
#

If it still says spawn git / path git, then npm still can’t see git on PATH in the exact environment where you’re running npm.

Run these in the same terminal where you run npm install, and paste the output:

where git
git --version
npm config get git
echo %PATH%

Common “it doesn’t work” causes + fixes:

  1. Git is installed but not added to PATH
  • where git returns “INFO: Could not find files…”
  • Fix: add Git to PATH (recommended entry is usually):
    • C:\Program Files\Git\cmd
#

Then close all terminals (including VS Code) and reopen.

  1. Git installed but installer option was wrong
  • Re-run the Git for Windows installer and choose:
    “Git from the command line and also from 3rd-party software”
  1. Quick workaround: tell npm the exact git path
    If where git shows something like C:\Program Files\Git\cmd\git.exe, do:
npm config set git "C:\\Program Files\\Git\\cmd\\git.exe"

Then retry your install.

Also: what command are you running when it fails (e.g. npm i, npm install <pkg>, pnpm install), and what project/package is it? That determines why npm needs git in the first place.

acoustic wren
#

node.exe : npm error code 3221225477
所在位置 行:1 字符: 1

  • & "C:\Program Files\nodejs/node.exe" "C:\Program Files\nodejs/node_mo ...
  •   + CategoryInfo          : NotSpecified: (npm error code 3221225477:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
bitter sentinelBOT
#

That new one is a different problem: 3221225477 is a Windows process crash code (decimal). It’s 0xC0000005 = “Access violation”, meaning node.exe crashed, not a normal npm “dependency failed” error.

Let’s isolate it quickly:

1) Does Node itself run?

In PowerShell, run:

& "C:\Program Files\nodejs\node.exe" -v
& "C:\Program Files\nodejs\node.exe" -e "console.log('ok')"
  • If either of those crashes / returns 3221225477 → your Node install (or OS compatibility) is busted, and npm will never work until Node is fixed.

2) Check Windows + Node situation

Paste output of: