指定eslint的节点版本 [英] Specify node version for eslint

查看:519
本文介绍了指定eslint的节点版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将eslint用于Node.js应用程序。我正在运行节点版本v10.6.0,但是当我在项目的根目录中运行 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'

我的。 eslintrc.json 看起来像这样:

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

和我的 package.json 包含:

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

如何告诉eslint我正在使用较新的节点版本?我正在使用eslint v5.2.0。

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

推荐答案

engine 属性 package.json 文件中的错误,应改为 engines 。 eslint使用此属性来确定节点版本。

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.

这篇关于指定eslint的节点版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆