-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V9 doesn't work after install #1366
Comments
Here's the contents of #!/usr/bin/env node
import f, { writeFileSync as w } from 'fs'
import i from './index.js'
let a = process.argv[2]
if (a == 'init') {
let p = 'package.json'
let d = JSON.parse(f.readFileSync(p))
;(d.scripts ||= {}).prepare = 'husky'
w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n')
process.stdout.write(i())
try { f.mkdirSync('.husky') } catch {}
w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test\n')
process.exit()
}
let d = c => console.error(`${c} command is deprecated`)
if (['add', 'set', 'uninstall'].includes(a)) { d(a); process.exit(1) }
if (a == 'install') d(a)
process.stdout.write(i(a == 'install' ? undefined : a)) |
Hi what's your version of Node? |
node 20 for me |
Weird that syntax should be supported |
Experiencing the same, build failing in github actions. Had to go back to 8.0.3. Node version is 18 though, upgraded to 20 and still the same error. |
What's your exact Node version? I'll give it a try locally later. I can't seem to reproduce the issue with GitHub Actions: Also |
Hi @typicode, sorry for the late reply, node v18.15.0, but I think I know what my issue is, in my package.json I still have Should I replace this with "npx husky init" instead? |
Replace it with |
And thanks for the details, I'm still not sure why there's a syntax error |
yeah this doesn't work anymore, so my structure of project is this: repo-root/package/.husky I had this and it worked (filtering out when CI): I changed it to be
|
|
OK I removed the shell code, I used it to check if it's in CI environment to not run the install script. Do you know any better way? I remember finding some package |
Hi @typicode , changing prepare script from "npx husky install" to just "husky" did not solve my issue. Still encoutering the same error in our github workflow. NodeJS is updated however. |
Sorry, I don't know why it's failing. Here I'm using husky v9 in a GitHub Action: There's no error. Is your repo public? |
Hi @typicode , sorry for the late reply, sorry it is private, will just move back to version 8 for now, then will investigate further. I'll let you know once I either fix it or found something. Thank you for your time. |
Fix typicode#1366 by adding documentation to `how-to.md`
Basically what I did:
and then:
Troubleshoot
https://typicode.github.io/husky/troubleshoot.html
If you're migrating from husky 4, see:
https://typicode.github.io/husky/migrate-from-v4.html
Context
The text was updated successfully, but these errors were encountered: