visual-studio-code - 使用特定节点版本运行 git pre-commit hook
问题描述
我正在处理多个 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 扩展使用的节点版本?
解决方案
推荐阅读
- c++ - 我如何在封闭类中调用封闭类对象的构造函数
- windows - AWS CodeDeploy 未能部署到 Windows 10 本地计算机
- regex - 打印不是数字的行
- c# - 带有 DBQuery 的 Entity Framework Core 2 - 获取未设置为对象实例的对象引用
- xcode - 如何在 xcode 11.2 中链接 ftdi d2xx dylib?
- angular - 在更新新数据标记之前删除标记
- influxdb - 涌入数据库 | 获取最后一点和第一点之间的经过时间
- google-cloud-platform - 当使用相同的子网 IP 创建两个 GCP VPN 时,会导致故障排除
- rstudio - 如何将 Azure Databricks 中的 RStudio 连接到 Delta Lake
- windows - 批处理命令以列出文件夹中的文件并添加文本