commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

fix: pnpm commit execution error

Open limuen opened this issue 1 year ago • 7 comments

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

limuen avatar Oct 15 '24 08:10 limuen

The project has been running for over a year, but recently I opened it and updated the dependencies, but I can't submit it

limuen avatar Oct 15 '24 08:10 limuen

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?

escapedcat avatar Oct 15 '24 10:10 escapedcat

use pnpm 8.15.4

limuen avatar Oct 17 '24 09:10 limuen

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

LiuWenXing1996 avatar Oct 17 '24 16:10 LiuWenXing1996

该项目已经运行了一年多,但最近我打开它并更新了依赖项,但我无法提交它

你解决了这个错误吗?我也遇到了类似的错误,我通过将 @commitlint/prompt-cli 版本回退到 19.4.1 来绕过这个错误

I can only manually enter the git command to submit now

limuen avatar Oct 18 '24 01:10 limuen

该项目已经运行了一年多,但最近我打开它并更新了依赖项,但我无法提交它

你解决了这个错误吗?我也遇到了类似的错误,我通过将 @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",

pushduck avatar Nov 14 '24 08:11 pushduck

i encountered this problem too, use "czg": "^1.9.4" to solve this problem

kunglin avatar Mar 13 '25 03:03 kunglin