Closed kazazor closed 7 years ago
This is being caused because the precommit hook was defined like this:
"precommit": "gulp pre-commit --env=development"
Instead of:
"precommit": "node_modules/.bin/gulp pre-commit --env=development"
The way git-pre-commit
currently works is that it takes the script's command and execute it (gulp pre-commit --env=development
).
By doing that, we do not gain the PATH resolution in the npm run command, that says:
In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write:
"scripts": {"test": "tap test/\*.js"}
instead of
"scripts": {"test": "node_modules/.bin/tap test/\*.js"} to run your tests.
So if you do not have gulp
installed globally git-pre-commit
will cause issues for you.
Instead of running the command inside the npm script, run the command npm run precommit
The example script:
The error: