虽然这方面还有其他问题,但大多数都没有得到答复,或者给出的答复对我不起作用。
显然,它给出的结果是在node_modules中看到的,下面是给定的错误:
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/kamoraes/Workspace/node_adc/node_modules/supports-color/index.js from /home/kamoraes/Workspace/node_adc/.git/hooks/commit-msg not supported.
Instead change the require of index.js in /home/kamoraes/Workspace/node_adc/.git/hooks/commit-msg to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/kamoraes/Workspace/node_adc/.git/hooks/commit-msg:8:23) {
code: 'ERR_REQUIRE_ESM'
}
Node v16.13.0问题是,该项目处于它的第一步,快速地在同一节点和纱线上的另一台机器上重新执行项目,版本,不要给出相同的错误。还让我的一个朋友试试。没有错误。
此外,这个项目是一个过程,相同的步骤,下面是我现在的全部代码:
这个给定错误的最后提交是chore: eslintignore 6250e5bdea05cc2eb413c8a57a97e4bbe4bd5bb9
我加了哈士奇,皮棉
yarn add -D husky lint-staged然后添加它们各自的配置文件。
.huskyrc.json:
{
"hooks": {
"pre-commit": "lint-staged"
}
}.lintstagedrd.json:
{
"*.ts": [
"eslint 'src/**' --fix",
"git add"
]
}供参考: tsconfig:
{
"compilerOptions": {
"outDir" : "./dist",
"module": "commonjs",
"target": "es2019",
"strictNullChecks": true,
"esModuleInterop": true,
"allowJs": true
}
}eslintrc:
{
"extends": "standard-with-typescript",
"parserOptions": {
"project": "./tsconfig.json"
}
}gitignore和eslintignore都忽略node_modules和dist
发布于 2022-04-18 17:58:15
也遇到了同样的问题。你可以用git commit -m "your message here" --no-verify绕过支票。
https://stackoverflow.com/questions/69960974
复制相似问题