0

how to fix below error when use git commit lint, I'm not sure whether from commitlint.

I looked through the contents of the @commitlint/load package but couldn’t find anything wrong.

node:internal/modules/run_main:123
    triggerUncaughtException(
    ^

Error: Cannot find package 'C:\Users\Administrator\AppData\Local\pnpm-cache\dlx\2ac053088ac4ee3a4a417754159164c14c8ecc6b5a3dc79b369c251230800d47\1995a3ca9b0-5f34\node_modules\.pnpm\@[email protected]_@[email protected][email protected]\node_modules\@commitlint\config-validator\lib\validate.js' imported from C:\Users\Administrator\AppData\Local\pnpm-cache\dlx\2ac053088ac4ee3a4a417754159164c14c8ecc6b5a3dc79b369c251230800d47\1995a3ca9b0-5f34\node_modules\.pnpm\@[email protected]_@[email protected][email protected]\node_modules\@commitlint\load\lib\load.js
Did you mean to import "@commitlint/config-validator/lib/validate.js"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:860:14)
    at moduleResolve (node:internal/modules/esm/resolve:946:18)
    at defaultResolve (node:internal/modules/esm/resolve:1188:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:574:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:236:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:130:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v20.19.0
husky - commit-msg script failed (code 1)
git exited with error code 1

other enviroment:

    "@commitlint/cli": "^19.8.1",
    "@commitlint/config-conventional": "^19.8.1",
    "husky": "^9.1.7",
    "lint-staged": "^16.1.6",

commitlint.config.js

export default { extends: ['@commitlint/config-conventional'] };
1
  • I don't think this is a git question. If that happens when you run git commit, then it's probably a commit hook (something external to git) that is firing up and failing. Commented Sep 18 at 7:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.