question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: spawn git ENOENT in events.js:160

See original GitHub issue

version: 4.0.4

"scripts": {
      "precommit": "lint-staged",
},
"lint-staged": {
      "gitDir": "./path/to/packagejson/",
    "*.js": [
      "eslint --fix",
      "git add"
    ]
}
  • git add” some files
  • git commit” produce:
> husky > npm run -s precommit (node v6.10.3)
> 
> events.js:160
>       throw er; // Unhandled 'error' event
>       ^
> 
> Error: spawn git ENOENT
>     at exports._errnoException (util.js:1018:11)
>     at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
>     at onErrorNT (internal/child_process.js:367:16)
>     at _combinedTickCallback (internal/process/next_tick.js:80:11)
>     at process._tickCallback (internal/process/next_tick.js:104:9)
> 
> husky > pre-commit hook failed (add --no-verify to bypass)

No other node process on background.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
okonetcommented, Aug 29, 2017

Try to use the following config:

"lint-staged": {
  "gitDir": "./path/to/packagejson/",
  "linters" : {  
    "*.js": [
      "eslint --fix",
      "git add"
    ]
  }
}
1reaction
okonetcommented, Sep 4, 2017

See also #141

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code Error: spawn git ENOENT - Stack Overflow
I get the error Error: spawn git ENOENT when I try to view git history using https://github.com/DonJayamanne/gitHistoryVSCode on VS Code.
Read more >
cmd always show this problems, please help me figure out this ...
events.js:160 throw er; // Unhandled 'error' event ^. Error: spawn cmd ENOENT at exports._errnoException (util.js:1022:11) at Process.ChildProcess.
Read more >
Ionic CLI error after 3.6.0 update
[DEBUG] New daemon pid: 39216 events.js:160 throw er; // Unhandled 'error' event ^ Error: spawn C:\Program Files\nodejs\node.exe ENOENT at ...
Read more >
Serverless Offline Error – sls offline start | What I Broke
serverles events.js:160 throw er Unhandled 'error' event spawn java ENOENT at exports._errnoException (util.js:1020:11) at Process.
Read more >
errno: -4058, code: 'enoent', syscall: 'spawn git', path - You.com
node:events:505 throw er; // Unhandled 'error' event ^ Error: spawn git ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found