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
#npm error code ENOENTnpm error syscall spawn gitnpm error path gitnpm error errno -4058npm error
1 messages · Page 1 of 1 (latest)
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:
- Verify git is actually available
git --version
where git
If those fail → Git isn’t installed or isn’t on your PATH.
- Install Git for Windows (or add it to PATH)
- Install: https://git-scm.com/download/win
During install, pick the option like “Git from the command line and also from 3rd-party software”.
Or via winget:
winget install --id Git.Git -e
-
Restart your terminal / VS Code (PATH changes won’t show up in already-open shells)
-
Re-run your
npm install/pnpm install.
If git --version works but npm still errors, paste:
- the exact command you ran
- the
package.jsonline that references a git dependency (or tell me what project you’re installing)
It doesn’t work.
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:
- Git is installed but not added to PATH
where gitreturns “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.
- 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”
- Quick workaround: tell npm the exact git path
Ifwhere gitshows something likeC:\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.
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
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: