简体   繁体   中英

Specify node version for eslint

I'm using eslint for a Node.js application. I'm running node version v10.6.0, but when I run eslint in the root directory of my project, I get error messages like the following:

The 'URL' is not supported until Node.js 10.0.0. The configured version range is '>=6.0.0'

My .eslintrc.json looks like this:

{
  "extends": [
    "eslint:recommended",
    "plugin:node/recommended",
  ],
  "parserOptions": {
    "sourceType": "module"
  }
}

and my package.json contains:

"engine": {
    "node": ">=10.6.0"
}

How can I tell eslint that I'm using a newer node version? I'm using eslint v5.2.0.

The engine property in the package.json file is incorrect and should be engines instead. This is the property that eslint uses to determine the node version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM