Lewis
Lewis

Reputation: 2198

Unsupported engine, when installing eslint-plugin-react

New react user here, I'm encountering the following error in my terminal when I install eslint-plugin-react and eslint-plugin-react-hooks.

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@es-joy/[email protected]',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || ^16' },
npm WARN EBADENGINE   current: { node: 'v17.3.0', npm: '8.3.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || ^16' },
npm WARN EBADENGINE   current: { node: 'v17.3.0', npm: '8.3.0' }
npm WARN EBADENGINE }

package.json

{
  "name": "postcode-pricing",
  "version": "1.0.0",
  "description": "Lorum Ipsum",
  "main": "index.js",
  "scripts": {
    "build": "wp-scripts build",
    "start": "wp-scripts start",
    "start:custom": "wp-scripts start src/index.js --output-path=admin/build",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@wordpress/scripts": "^19.2.2",
    "eslint": "^7.32.0",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0"
  }
}

.eslintrc.json

{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": ["plugin:react/recommended", "google"],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 12,
    "sourceType": "module"
  },
  "plugins": ["react", "react-hooks", "@typescript-eslint"],
  "rules": {
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn"
  }
}

Is anyone able to help me make sense of these particular errors?

Upvotes: 6

Views: 7021

Answers (1)

dropdb
dropdb

Reputation: 656

This error means that these two packages require Node 12, 14, or 16 but your Node version is 17.

It is just warnings and packages will be properly installed just like other ones. However there might be an error caused by Node version mismatch. Best way is to temporarily use Node 16(if you use NVM).

Upvotes: 5

Related Questions