5

I'm working on multiple nodejs projects and managing different versions with nave.

In one of the projects there's a pre-commit hook which fails because the node I have globally installed is 12.6, however the project requires < 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.

Is there any way to change the node version that is used by vscode or by the Git extension?

Akos K
  • 7,071
  • 3
  • 33
  • 46
  • Not a complete solution, but I work on a project that requires a low version of node, so I use [nvm](https://github.com/nvm-sh/nvm) to switch version whenever I'm working on that code. There's a [windows port](https://github.com/coreybutler/nvm-windows) as well. – Sam L Aug 29 '19 at 08:19
  • check this out : https://stackoverflow.com/questions/44700432/visual-studio-code-to-use-node-version-specified-by-nvm – Sandeep Patel Aug 29 '19 at 09:07

0 Answers0