I have a work project where I need to enforce an older version (10.24.1) of nodejs on eslint.
I'm managing my node version via nvm. Specifically, I've set my default version of nodejs to said 10.24.1 via
$ nvm alias default 10

This also checks out with running version and set eslint env version.
$ node -v
$ npx eslint --env-info

However, locally my ESLint seems to crash when viewing files in visual-studio-code.

I also tried specifying in local configuration in package.json:
"engines": {
"node": ">=10.24.1"
}
This however seems to take no effect. So I'm not really sure what else I should do.
Is there any idea on how to enforce the eslint server to run on my specified node version instead of the v14.6.0?
For users of VS Code add the following setting to your settings.json:
"eslint.runtime": "node"
The only thing you need to do is use the setting eslint.runtime to specify the Node version you want the ESLint server to run on. There is no need to set the nvmrc nor to reinstall the package.
// settings.json
{
"eslint.runtime": "/Users/user/.nvm/versions/node/v16.17.1/bin/node"
}
If you don't know where your node binary file is, you can use where node to find out if you are using a Unix-like terminal.
After saving the settings, an important thing is to restart your VSCode (it might not be enough if you only restart the ESLint server). You should see it run on a different version after that in the VSCode.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With