precommit hook causes upgrade to fail

610 views
Skip to first unread message

Matt Raible

unread,
Jun 20, 2018, 6:11:55 PM6/20/18
to JHipster dev team
Hey everyone,

I’ve tried to upgrade an app I’m developing to JHipster v5 on both Mac and Linux. When I run “jhipster upgrade”, it keeps failing with the following error:

——
✔ Successfully regenerated application with JHipster 5.0.0-beta.2
info Removing src/main/resources/keystore.jks
info git add -A
info git commit -q -m "Generated with JHipster 5.0.0-beta.2" -a --allow-empty
husky > npm run -s precommit (node v9.8.0)

sh: lint-staged: command not found

husky > pre-commit hook failed (add --no-verify to bypass)
events.js:165
throw er; // Unhandled 'error' event
^

Error: ERROR! Unable to commit in git:
husky > npm run -s precommit (node v9.8.0)

sh: lint-staged: command not found

husky > pre-commit hook failed (add --no-verify to bypass)
——

If I try to run “lint-staged”, it fails:

——
➜ okta-react-photo-gallery-example git:(jhipster_upgrade) ✗ lint-staged
zsh: command not found: lint-staged
——


It even fails if I run “npm run lint-staged”:

——
npm run lint-staged
npm ERR! missing script: lint-staged

npm ERR! A complete log of this run can be found in:
——

My package.json has the following, but it doesn’t seem to be working as expected.

——
"lint-staged": {
"src/**/*.{ts,tsx,css,scss}": ["prettier --write", "git add"]
},
"scripts": {
"precommit": "lint-staged”,
——

Thanks,

Matt

Deepu K Sasidharan

unread,
Jun 21, 2018, 1:36:26 AM6/21/18
to Matt Raible, JHipster dev team
Thats weird. Not sure what changed. Will check it out later

--
You received this message because you are subscribed to the Google Groups "JHipster dev team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jhipster-dev...@googlegroups.com.
To post to this group, send email to jhipst...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jhipster-dev/4E5C6471-5F76-4271-AADD-245778F1FB5B%40raibledesigns.com.
For more options, visit https://groups.google.com/d/optout.

Erik Kemperman

unread,
Jun 21, 2018, 1:40:40 AM6/21/18
to Deepu K Sasidharan, Matt Raible, JHipster dev team
I noticed something similar a while back — it’s like a git hook is trying to run a npm binary before it’s installed. I was in a hurry at the time, so couldn’t investigate properly.

Maybe, as a quick and dirty workaround, run the upgrade command in IDE, set breakpoint just before the failing commit is triggered, and run `npm install` by hand?

Matt Raible

unread,
Jun 21, 2018, 2:13:09 AM6/21/18
to Erik Kemperman, Deepu K Sasidharan, JHipster dev team
I figured out a workaround:

rm -rf *
Change .yo-rc.json to update JHipster version
jhipster —with-entities
Use git diff to restore changes I made to files

Not great, but it works!
Reply all
Reply to author
Forward
0 new messages