使用特定的节点版本运行git pre-commit挂钩

时间:2019-08-29 08:10:18

标签: visual-studio-code

我正在处理多个nodejs项目,并使用nave管理不同的版本。

在一个项目中,有一个预提交挂钩失败,因为我全局安装的节点是12.6,但是该项目要求<12.6:

> git add -A -- .
> git commit --quiet --allow-empty-message --file - --all
Running commit hook for:
  ?  - ESLint
  ?  - Codeowners
[2K[1A[2K[1A  ?  - ESLint
  ?  - Codeowners
[2K[1A[2K[1A  ?  - ESLint
  ?  - Codeowners
[2K[1A[2K[1A  ?  - ESLint
  ?  - Codeowners
[2K[1A[2K[1A  ?  - ESLint
  ✅  - Codeowners
[2K[1A[2K[1A  ?  - ESLint
  ✅  - Codeowners
[2K[1A[2K[1A  ❌  - ESLint
  ✅  - Codeowners

Results for ESLint
yarn run v1.17.3
warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
error my-project@1.1.0: The engine "node" is incompatible with this module. Expected version ">=10.13 <12.6". Got "12.6.0"
error Commands cannot run with an incompatible environment.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

是否可以更改vscode或Git扩展使用的节点版本?

0 个答案:

没有答案