node.jsnpmyarnpkg

yarn install: error glob@11.0.0: The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "16.20.2"


Two months ago all was OK, but now I get an error when tried to run yarn install:

verbose 33.786740568 Performing "GET" request to "https://registry.yarnpkg.com/os-homedir".
verbose 33.822862421 Request "https://registry.yarnpkg.com/os-homedir" finished with status code 200.
verbose 33.823871025 Performing "GET" request to "https://registry.yarnpkg.com/gulp-less".
verbose 33.918661822 Request "https://registry.yarnpkg.com/gulp-less" finished with status code 200.
verbose 33.926033135 Performing "GET" request to "https://registry.yarnpkg.com/gulp-postcss".
verbose 33.994670505 Request "https://registry.yarnpkg.com/gulp-postcss" finished with status code 200.
[2/4] Fetching packages...
error glob@11.0.0: The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "16.20.2"
verbose 36.305657124 Error: Found incompatible module.
    at MessageError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:721:66)
    at new MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:750:123)
    at checkOne (/usr/local/lib/node_modules/yarn/lib/cli.js:47866:11)
    at Object.check (/usr/local/lib/node_modules/yarn/lib/cli.js:47885:5)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:7351:73
    at Generator.next (<anonymous>)
    at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:321:13
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I didn't change any requirements or others in package.json. Where I can find information, which component now requires glob@11.0.0?

My package.json looks like:

{
<some text>
  "dependencies": {
    "@rjsf/antd": "^3.2.0",
    "@rjsf/core": "^3.2.0",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "antd": "^4.16.10",
    "antd-theme-webpack-plugin": "^1.3.9",
    "axios": "^0.21.1",
    "babel-plugin-import": "^1.13.3",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-plugin-export": "^0.1.2",
    "jsencrypt": "^3.2.1",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "react": "^17.0.2",
    "react-css-theme-switcher": "^0.3.0",
    "react-dom": "^17.0.2",
    "react-icons": "4.8.0",
    "react-iframe": "^1.8.0",
    "react-page-visibility": "^6.4.0",
    "react-redux": "^7.2.4",
    "react-responsive": "^9.0.0-beta.3",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-timing-hooks": "^2.0.0",
    "redux": "^4.1.1",
    "redux-thunk": "^2.3.0",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
<some text>
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
<some text>
  },
  "devDependencies": {
    "autoprefixer": "^9.8.4",
    "gulp": "^4.0.2",
    "gulp-csso": "^4.0.1",
    "gulp-debug": "^4.0.0",
    "gulp-less": "5.0.0",
    "gulp-postcss": "^8.0.0",
    "less-plugin-npm-import": "^2.1.0"
  }
}
  1. I tried to set Node version to 20, but got a lot of deprecated dependencies.

  2. I tried to regenerate yarn.lock, but it fails with error above.

  3. I tried to run with --ignore-engines, but got a new error on next steps:

    ./src/index.js
    
    Error: [BABEL] /app/src/index.js: Requires Babel "^7.16.0", but was loaded with "7.12.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing: "/app/node_modules/babel-preset-react-app/index.js$0$2)
    

Solution

  • You can either downgrade to Node 20 or upgrade to Node 22. If you have NVM you can change easily with nvm use 20 or upgrade to Node 22 with nvm use 22. I had to upgrade to 22 because downgrading had me hit another range conflict 🤦.