-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Open
Labels
Description
Describe the bug
When committing changes to .ejs files in the code/ directory, the pre-commit hook fails with ENOENT error.
husky > pre-commit (node v22.21.1)
✔ Backed up original state in git stash (b5858fbb44c)
⚠ Running tasks for staged files...
❯ package.json — 1 file
↓ *.{html,js,json,jsx,mjs,ts,tsx} — no files
❯ *.ejs — 1 file
✖ ../scripts/node_modules/.bin/ejslint [FAILED]
↓ *.{css,html,json,md,yml} — no files
↓ package.json — no files
↓ Skipped because of errors from tasks.
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...
✖ ../scripts/node_modules/.bin/ejslint failed to spawn:
Command failed: ../scripts/node_modules/.bin/ejslint <repo>/code/core/assets/server/template.ejs
Error: spawn ../scripts/node_modules/.bin/ejslint ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn ../scripts/node_modules/.bin/ejslint',
path: '../scripts/node_modules/.bin/ejslint',
spawnargs: [
'<repo>/code/core/assets/server/template.ejs'
]
}
husky > pre-commit hook failed (add --no-verify to bypass)
Reproduction link
...
Reproduction steps
- Modify any
.ejsfile (e.g., code/core/assets/server/template.ejs) - Run
git add . && git commit -m "test"
System
OS: Linux (WSL)
Node.js: v22.21.1
Yarn: v4.10.3 (via corepack)
corepack: enabled and active
yarn binary: ~/.nvm/versions/node/v22.21.1/bin/yarnAdditional context
This repository uses nodeLinker: node-modules in .yarnrc.yml.
According to the Yarn Berry documentation,
nmHoistingLimitsis not set, so it defaults tonone.- With
nmHoistingLimits: none, Yarn hoists packages as much as possible to the project rootnode_modules. - Therefore,
ejs-lintdeclared inscripts/package.jsonis hoisted tonode_modules/.bin/ejslintat the project root instead of staying underscripts/node_modules/.bin/ejslint.
/storybook/scripts$ ls node_modules/.bin/ejslint
ls: cannot access 'node_modules/.bin/ejslint': No such file or directory
/storybook/scripts$ cd ..
/storybook$ ls node_modules/.bin/ejslint
node_modules/.bin/ejslint```dosubotcoderabbitai