简体   繁体   English

指定eslint的节点版本

[英]Specify node version for eslint

I'm using eslint for a Node.js application. 我将eslint用于Node.js应用程序。 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: 我正在运行节点版本v10.6.0,但是当我在项目的根目录中运行eslint时,会收到如下错误消息:

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: 我的.eslintrc.json看起来像这样:

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

and my package.json contains: 我的package.json包含:

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

How can I tell eslint that I'm using a newer node version? 如何告诉eslint我正在使用较新的节点版本? I'm using eslint v5.2.0. 我正在使用eslint v5.2.0。

The engine property in the package.json file is incorrect and should be engines instead. package.json文件中的engine属性不正确,应改为engines This is the property that eslint uses to determine the node version. eslint使用此属性来确定节点版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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