Npm warning-gatsby

I need help with deployment. I see I'm getting warnings for some dependencies as well as unsupported engine. How would I go about solving this? Any help would be greatly appreciated. This is the deploy log:

6:27:25 PM: build-image version: 91488c6c0412f5c1c00fb34eff5c1fc41a32bce9 (focal)
6:27:25 PM: buildbot version: 91488c6c0412f5c1c00fb34eff5c1fc41a32bce9
6:27:25 PM: Fetching cached dependencies
6:27:25 PM: Failed to fetch cache, continuing with build
6:27:25 PM: Starting to prepare the repo for build
6:27:25 PM: No cached dependencies found. Cloning fresh repo
6:27:25 PM: git clone --filter=blob:none https://github.com/Bennyno/gatsby-blog
6:27:25 PM: Preparing Git Reference refs/heads/main
6:27:26 PM: Parsing package.json dependencies
6:27:27 PM: Starting to install dependencies
6:27:27 PM: Python version set to 3.8
6:27:27 PM: Attempting Ruby version 2.7.2, read from environment
6:27:28 PM: Using Ruby version 2.7.2
6:27:28 PM: Started restoring cached go cache
6:27:28 PM: Finished restoring cached go cache
6:27:28 PM: Installing Go version 1.19.5 (requested 1.19.5)
6:27:33 PM: go version go1.19.5 linux/amd64
6:27:33 PM: Using PHP version 8.0
6:27:34 PM: v16.20.0 is already installed.
6:27:34 PM: Now using node v16.20.0 (npm v8.19.4)
6:27:34 PM: Enabling Node.js Corepack
6:27:34 PM: Started restoring cached build plugins
6:27:34 PM: Finished restoring cached build plugins
6:27:34 PM: Started restoring cached corepack dependencies
6:27:34 PM: Finished restoring cached corepack dependencies
6:27:34 PM: No npm workspaces detected
6:27:34 PM: Started restoring cached node modules
6:27:34 PM: Finished restoring cached node modules
6:27:35 PM: Installing npm packages using npm version 8.19.4
6:27:36 PM: npm WARN ERESOLVE overriding peer dependency
6:27:36 PM: npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
6:27:36 PM: npm WARN Found: react@18.2.0
6:27:36 PM: npm WARN node_modules/react
6:27:36 PM: npm WARN   react@"^18.2.0" from the root project
6:27:36 PM: npm WARN   9 more (@gatsbyjs/reach-router, gatsby, gatsby-link, ...)
6:27:36 PM: npm WARN
6:27:36 PM: npm WARN Could not resolve dependency:
6:27:36 PM: npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
6:27:36 PM: npm WARN node_modules/react-server-dom-webpack
6:27:36 PM: npm WARN   react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.8.1
6:27:36 PM: npm WARN   node_modules/gatsby
6:27:36 PM: npm WARN
6:27:36 PM: npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
6:27:36 PM: npm WARN node_modules/react
6:27:36 PM: npm WARN   peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
6:27:36 PM: npm WARN   node_modules/react-server-dom-webpack
6:27:36 PM: npm WARN     react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.8.1
6:27:36 PM: npm WARN     node_modules/gatsby
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: '@gatsbyjs/parcel-namer-relative-to-cwd@2.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0', parcel: '2.x' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'babel-plugin-remove-graphql-queries@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'babel-preset-gatsby@3.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby@5.8.1',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-cli@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-core-utils@4.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-graphiql-explorer@3.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-link@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-page-utils@3.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-plugin-manifest@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-plugin-page-creator@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-plugin-sharp@5.8.1',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-plugin-styled-components@6.9.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-plugin-typescript@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-plugin-utils@4.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-react-router-scroll@6.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-script@2.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-sharp@1.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-source-filesystem@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-telemetry@4.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-transformer-remark@6.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-transformer-sharp@5.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: 'gatsby-worker@2.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }
6:27:39 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
6:27:42 PM: npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
6:27:42 PM: npm WARN deprecated @types/keyv@4.2.0: This is a stub types definition. keyv provides its own type definitions, so you do not need this installed.
6:27:55 PM: added 1473 packages, and audited 1474 packages in 20s
6:27:55 PM: 312 packages are looking for funding
6:27:55 PM:   run `npm fund` for details
6:27:55 PM: 7 vulnerabilities (1 moderate, 6 high)
6:27:55 PM: To address all issues, run:
6:27:55 PM:   npm audit fix
6:27:55 PM: Run `npm audit` for details.
6:27:55 PM: npm packages installed
6:27:55 PM: Install dependencies script success
6:27:55 PM: Starting build script
6:27:56 PM: Detected 1 framework(s)
6:27:56 PM: "gatsby" at version "5.8.1"
6:27:56 PM: Section completed: initializing
6:27:58 PM: ​
6:27:58 PM:   Netlify Build                                                 
6:27:58 PM: ────────────────────────────────────────────────────────────────
6:27:58 PM: ​
6:27:58 PM: ❯ Version
6:27:58 PM:   @netlify/build 29.9.2
6:27:58 PM: ​
6:27:58 PM: ❯ Flags
6:27:58 PM:   baseRelDir: true
6:27:58 PM:   buildId: 643f194931419e0b95f89e75
6:27:58 PM:   deployId: 643f194931419e0b95f89e77
6:27:58 PM: ​
6:27:58 PM: ❯ Current directory
6:27:58 PM:   /opt/build/repo
6:27:58 PM: ​
6:27:58 PM: ❯ Config file
6:27:58 PM:   No config file was defined: using default values.
6:27:58 PM: ​
6:27:58 PM: ❯ Context
6:27:58 PM:   production
6:27:58 PM: ​
6:27:58 PM: ❯ Installing plugins
6:27:58 PM:    - @netlify/plugin-gatsby@3.6.1
6:28:08 PM: ​
6:28:08 PM: ❯ Loading plugins
6:28:08 PM:    - @netlify/plugin-gatsby@3.6.1 from Netlify app
6:28:10 PM: ​
6:28:10 PM:   1. @netlify/plugin-gatsby (onPreBuild event)                  
6:28:10 PM: ────────────────────────────────────────────────────────────────
6:28:10 PM: ​
6:28:10 PM: No Gatsby cache found. Building fresh.
6:28:10 PM: ​
6:28:10 PM: (@netlify/plugin-gatsby onPreBuild completed in 10ms)
6:28:10 PM: ​
6:28:10 PM:   2. Build command from Netlify app                             
6:28:10 PM: ────────────────────────────────────────────────────────────────
6:28:10 PM: ​
6:28:10 PM: $ npm run build
6:28:10 PM: > gatsby-starter-default@0.1.0 build
6:28:10 PM: > gatsby build
6:28:10 PM: error Gatsby requires Node.js 18.0.0 or higher (you have v16.20.0).
6:28:10 PM: Upgrade Node to the latest stable release: https://gatsby.dev/upgrading-node-js
6:28:10 PM: ​
6:28:10 PM:   "build.command" failed                                        
6:28:10 PM: ────────────────────────────────────────────────────────────────
6:28:10 PM: ​
6:28:10 PM:   Error message
6:28:10 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
6:28:10 PM: ​
6:28:10 PM:   Error location
6:28:10 PM:   In Build command from Netlify app:
6:28:10 PM:   npm run build
6:28:10 PM: ​
6:28:10 PM:   Resolved config
6:28:10 PM:   build:
6:28:10 PM:     command: npm run build
6:28:10 PM:     commandOrigin: ui
6:28:10 PM:     publish: /opt/build/repo/public
6:28:10 PM:     publishOrigin: ui
6:28:10 PM:   plugins:
6:28:10 PM:     - inputs: {}
6:28:10 PM:       origin: ui
6:28:10 PM:       package: '@netlify/plugin-gatsby'
6:28:11 PM: Caching artifacts
6:28:11 PM: Started saving node modules
6:28:11 PM: Finished saving node modules
6:28:11 PM: Started saving build plugins
6:28:11 PM: Finished saving build plugins
6:28:11 PM: Started saving corepack cache
6:28:11 PM: Finished saving corepack cache
6:28:11 PM: Started saving pip cache
6:28:11 PM: Finished saving pip cache
6:28:11 PM: Started saving emacs cask dependencies
6:28:11 PM: Finished saving emacs cask dependencies
6:28:11 PM: Started saving maven dependencies
6:28:11 PM: Finished saving maven dependencies
6:28:11 PM: Started saving boot dependencies
6:28:11 PM: Finished saving boot dependencies
6:28:11 PM: Started saving rust rustup cache
6:28:11 PM: Finished saving rust rustup cache
6:28:12 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:28:11 PM: Started saving go dependencies
6:28:11 PM: Finished saving go dependencies
6:28:12 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:28:12 PM: Failing build: Failed to build site
6:28:12 PM: Finished processing build request in 47.178s

@Ben-fer Your build is executing with node v16.20.0 and the packages you’re working with want at least node v18.0.0.

6:27:34 PM: Now using node v16.20.0 (npm v8.19.4)
...
6:27:36 PM: npm WARN EBADENGINE Unsupported engine {
6:27:36 PM: npm WARN EBADENGINE   package: '@gatsbyjs/parcel-namer-relative-to-cwd@2.8.0',
6:27:36 PM: npm WARN EBADENGINE   required: { node: '>=18.0.0', parcel: '2.x' },
6:27:36 PM: npm WARN EBADENGINE   current: { node: 'v16.20.0', npm: '8.19.4' }
6:27:36 PM: npm WARN EBADENGINE }

There are several ways to set the node version that are outlined in the documentation here:

Thank you for providing the netlify docs. Adding an environment variable with the node version did the trick. I really appreciate it.

1 Like

thanks for coming back and sharing this solution with the community!

1 Like