commitlint
commitlint copied to clipboard
fix: pnpm commit execution error
Steps to Reproduce
1. pnpm commit
2. git add -A && czg && git push
3. [email protected]
Directory import '/Users/limuen/Documents/github/React-Pro-Admin/node_modules/.pnpm/@[email protected]/node_modules/@commitlint/config-conventional/lib' is not supported resolving ES modules imported from /Users/limuen/Documents/github/React-Pro-Admin/node_modules/.pnpm/@[email protected]/node_modules/@commitlint/config-conventional/wrapper.mjs
ELIFECYCLE Command failed with exit code 1.
Current Behavior
No response
Expected Behavior
Normally, the option to commit lint.config should appear
Affected packages
- [ ] cli
- [ ] core
- [ ] prompt
- [ ] config-angular
Possible Solution
No response
Context
No response
commitlint --version
18.6.3
git --version
2.39.3 (Apple Git-145)
node --version
20.10.0
The project has been running for over a year, but recently I opened it and updated the dependencies, but I can't submit it
Which pnpm version do you use now? Here's an unmerged PR which is related to pnpm: https://github.com/conventional-changelog/commitlint/pull/4019 Maybe this is related?
use pnpm 8.15.4
The project has been running for over a year, but recently I opened it and updated the dependencies, but I can't submit it
did you resolve this bug, I encountered a similar bug, I bypassed this bug by fallback @commitlint/prompt-cli version to 19.4.1
该项目已经运行了一年多,但最近我打开它并更新了依赖项,但我无法提交它
你解决了这个错误吗?我也遇到了类似的错误,我通过将 @commitlint/prompt-cli 版本回退到 19.4.1 来绕过这个错误
I can only manually enter the git command to submit now
该项目已经运行了一年多,但最近我打开它并更新了依赖项,但我无法提交它
你解决了这个错误吗?我也遇到了类似的错误,我通过将 @commitlint/prompt-cli 版本回退到 19.4.1 来绕过这个错误
I can only manually enter the git command to submit now
同样的问题,我也是装了 18.6.3 这个版本的 @commitlint/config-conventional
不更新版本的情况下,我是这样解决的:
定位到项目相对路径 node_modules/@commitlint/config-conventional/wrapper.mjs
实际路径可能是
E:\yourworkspace\yourproject\node_modules\.pnpm\@[email protected]\node_modules\@commitlint\config-conventional\wrapper.mjs
修改为以下内容,保存后再运行 pnpm commit
import pkg from './lib/index.js';
const { parserPreset, prompt, rules } = pkg;
export { parserPreset, prompt, rules };
export default pkg;
当然最好的方式是先暂时将版本锁定在 18.4.3 😋
"@commitlint/cli": "18.4.3",
"@commitlint/config-conventional": "18.4.3",
i encountered this problem too, use "czg": "^1.9.4" to solve this problem