royriojas / precommit

A precommit script that will execute certain tasks only on the files that were added to the git index stashing the other ones to avoid false positives when running validation tasks
MIT License
5 stars 2 forks source link

Doesn't spawn process #5

Open igidas opened 7 years ago

igidas commented 7 years ago

Hey, I can't get this package working on Windows.

In my package.json I have "precommit": ["npm run lint"], but it gives me ENOENT error. Tried to debug precommit hook and looks like working dir which spawned script uses is '.git/hooks' instead of project root folder.

royriojas commented 7 years ago

@igidas mmm that is interesting, can you please post your error log?

MundakaZgz commented 7 years ago

Hi there,

I am having the same issue. In my case the task I am running is eslint . --ext .json. The whole output is:

git commit -m "Tests pre-commit hook" applying precommit on branch pre-commit-check events.js:160 throw er; // Unhandled 'error' event ^ Error: spawn npm ENOENT at exports._errnoException (util.js:1022:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT (internal/child_process.js:359:16) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

Thanks!