Skip to content

故障排除

¥Troubleshooting

更新后获取 Range error: Found invalid rule names: [...]

¥Getting Range error: Found invalid rule names: [...] after update

更新一个或多个 @commitlint 软件包后,你可能会遇到类似以下错误:

¥After updating one or more @commitlint packages you might encounter an error like:

text
Found invalid rule names: header-trim.
Supported rule names are: body-case, body-empty, ...

此错误的根源可能是 node_modules@commitlint 软件包的版本不匹配。

¥The source of this error is likely a mismatch of version between @commitlint packages in node_modules.

例如:你可能有一个配置请求了 @commitlint/rules 中未包含的规则。

¥E.g.: you might have a config requesting a rule that is not included in @commitlint/rules.

[!TIP]

如果你依赖的配置依赖于早期版本的 @commitlint/config-conventional,请务必更新它们:

¥If you are relying on a config which depends on an earlier version of @commitlint/config-conventional be sure to update them:

sh
npm update @commitlint/config-conventional

有关错误的详细解释可以在此 [comment](https://github.com/conventional-changelog/commitlint/pull/3871#issuecomment-1911455325) 中找到。

¥[!NOTE] Detailed explanation about the error can be found in this comment.