gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

gatsby-core-utils & gatsby-telemetry 4.0.0 updates broke build on node 16 #36996

Closed maxsteenbergen closed 2 years ago

maxsteenbergen commented 2 years ago

Preliminary Checks

Description

I have a legacy project on Gitlab that's fixed on Node 16 for multiple reasons. After yesterday, the update from gatsby-core-utils & gatsby-telemetry to 4.0.0 introduced a dependency on Node 18, which is a breaking change to my daily builds. Removing the ^ didn't seem to do the trick.

Here's the relevant bit of my package.json:

"gatsby": "^2.18.4",
"gatsby-cli": "^2.11.10",
"gatsby-image": "^2.2.30",

and the actual error:

error gatsby-core-utils@4.0.0: The engine "node" is incompatible with this module. Expected version ">=18.0.0". Got "16.13.0"

Reproduction Link

https://gitlab.com/gvv-aspasia/site_volleybal/-/tree/publish

Steps to Reproduce

  1. Run Node 16
  2. Create project with Gatsby 2.18 & Gatsby 2.11
  3. Build project
  4. Build pulls in versions 4.0.0 of core-utils and telemetry
  5. Build fails

Expected Result

I'd expect the bump to gatsby-core-utils & gatsby-telemetry 4.0.0 to not update builds that have its version locked.

Actual Result

gatsby-core-utils 4.0.0 is marked as compatible when it actually isn't

Environment

GitLab Runner config:

image: node:16.13.2

pages:
  script:
    - yarn
    - yarn add gatsby-cli
    - yarn add @babel/core
    - node_modules/.bin/gatsby build --prefix-paths --verbose
  artifacts:
    paths:
      - public
  cache:
    paths:
      - node_modules
  only:
    - master

publish:
  before_script:
    - apt-get update -qy
    - apt-get install -y lftp
    - 'echo -e "set ftp:list-options -a" > ~/.lftprc'
    # Disable host key checking
    - mkdir -p ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
  script:
    - yarn
    - yarn add gatsby-cli
    - yarn add @babel/core
    - node_modules/.bin/gatsby build --verbose

Config Flags

No response

marvinjude commented 2 years ago

Hey @maxsteenbergen,

Your config pulls in the latest gatsby-cli version which is a new major and that's of course why you're running into this. You can already use the binary without needing to install gatsby-cli directly.

maxsteenbergen commented 2 years ago

@marvinjude Thanks! That worked, didn't even know that was unnecessary.

zanedev commented 1 year ago

Hi I'm seeing this error without including gatsby-cli and on an exisiting project where nothing changed. I tried downgrading my global cli in case that was the issue but no dice. How can I troubleshoot this? Here is my package.json dependencies below.

{
  "dependencies": {
    "@emotion/react": "^11.10.4",
    "@emotion/styled": "^11.10.4",
    "@mui/icons-material": "^5.10.3",
    "@mui/material": "^5.10.4",
    "@sanity/block-content-to-react": "^3.0.0",
    "@sanity/image-url": "^1.0.1",
    "axios": "^0.27.2",
    "console-feed": "^3.4.0",
    "date-fns": "^2.29.2",
    "framer-motion": "^6.3.4",
    "gatsby": "^4.22.0",
    "gatsby-plugin-gatsby-cloud": "^4.22.0",
    "gatsby-plugin-gdpr-cookies": "^2.0.9",
    "gatsby-plugin-google-analytics": "^4.22.0",
    "gatsby-plugin-google-fonts-with-attributes": "^1.0.8",
    "gatsby-plugin-google-gtag": "^4.22.0",
    "gatsby-plugin-google-tagmanager": "^4.22.0",
    "gatsby-plugin-image": "^2.22.0",
    "gatsby-plugin-material-ui": "^4.1.0",
    "gatsby-plugin-postcss": "^5.22.0",
    "gatsby-plugin-react-helmet": "^5.22.0",
    "gatsby-plugin-sharp": "^4.22.0",
    "gatsby-plugin-sitemap": "^5.22.0",
    "gatsby-source-filesystem": "^4.22.0",
    "gatsby-source-greenhouse-job-board": "^1.0.4",
    "gatsby-source-sanity": "^7.4.2",
    "gatsby-transformer-sharp": "^4.22.0",
    "gsap": "^3.11.1",
    "hls.js": "^1.2.1",
    "js-search": "^2.0.0",
    "lodash": "^4.17.21",
    "lottie-web": "^5.9.6",
    "postcss": "^8.4.16",
    "react": "^17.0.2",
    "react-cookie-consent": "^7.4.1",
    "react-countup": "^6.3.1",
    "react-dom": "^17.0.2",
    "react-gsap": "^3.2.1",
    "react-helmet": "^6.1.0",
    "react-id-swiper": "^4.0.0",
    "react-keyshape": "^3.3.0",
    "react-masonry-css": "^1.0.16",
    "react-player": "^2.10.1",
    "react-scrollmagic": "^2.3.0",
    "react-select": "^5.3.2",
    "react-use-query-param-string": "^2.0.3",
    "rooks": "^5.11.2",
    "swiper": "^8.3.2"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.18.9",
    "@babel/preset-react": "^7.18.6",
    "@netlify/plugin-gatsby": "^3.4.6",
    "dotenv": "^16.0.2",
    "eslint": "^8.23.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-config-standard-react": "^11.0.1",
    "eslint-loader": "^4.0.2",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-promise": "^6.0.1",
    "eslint-plugin-react": "^7.31.7",
    "eslint-webpack-plugin": "^3.1.1",
    "gatsby-plugin-eslint": "^4.0.2",
    "gatsby-plugin-netlify": "^5.0.1",
    "husky": "^8.0.1",
    "postcss-import": "^14.1.0",
    "postcss-preset-env": "^7.8.0",
    "prettier": "^2.7.1",
    "rimraf": "^3.0.2"
  },
}