precommit always fails, prints npm usage
murrayju opened this issue · comments
I have husky-hg
version 0.15.3
, and added a precommit
script to my package.json scripts.
# hg commit -m "add husky-hg commit hook for linting"
husky > npm run -s precommit
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
completion, config, create, ddp, dedupe, deprecate,
dist-tag, docs, doctor, edit, explore, get, help,
help-search, hook, i, init, install, install-test, it, link,
list, ln, login, logout, ls, outdated, owner, pack, ping,
prefix, profile, prune, publish, rb, rebuild, repo, restart,
root, run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
/home/murrayju/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@6.3.0 /usr/lib/node_modules/npm
husky > Command '['npm', 'run', '-s', 'precommit']' returned non-zero exit status 1
husky > precommit hook failed (add --no-verify to bypass)
abort: precommit hook failed
Seems to be a problem with how the hg script is executed, since the npm command works from the command line:
# npm run -s precommit
yarn run v1.9.2
$ babel-node tools/run lint
[14:55:53] Starting 'lint'...
[14:55:58] applying automatic eslint fixes
[14:55:58] eslint results:
/home/murrayju/.../index.test.js
32:11 warning 'a' is assigned a value but never used no-unused-vars
✖ 1 problem (0 errors, 1 warning)
[14:55:58] Finished 'lint' after 5018 ms
Done in 6.14s.
Am I missing something?
Same problem here with prepush
:[
husky-hg@0.15.3
, nvm@0.33.8
, node@10.14.0
, npm@6.4.1
on macOS@10.14.2
sorry for my late answer! I will try to have a look at that during the weekend!
I will publish a new version with the changes of #10 . Please check, if the problem still exists
@tobiastimm, will do
@mateatslc version 0.15.4 is published now
Now it doesn't seem to be triggering any of my hooks. Console output as if without husky-hg
. Tried prepush
and precommit
, same result.
@tobiastimm, never mind! That was me messing up my .hg
folder, my hooks
got lost somehow. Reinstalled husky-hg
to get the hooks
folder back.
Everything seems to be working alright now!
Cool! Glad to hear. I'm closing this issue now