Error deploy next 12.1.5

I’m having the following issue deploying Next.JS to netlify.

Please find below error log and package.json:

{
  "name": "ng",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "autoprefixer": "^10.4.4",
    "next": "12.1.5",
    "postcss": "^8.4.12",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "tailwindcss": "^3.0.24",
    "uuid": "^8.3.2"
  },
  "devDependencies": {
    "@types/node": "17.0.25",
    "@types/react": "18.0.5",
    "@types/react-dom": "18.0.1",
    "@types/uuid": "^8.3.4",
    "eslint": "^8.13.0",
    "eslint-config-next": "12.1.5",
    "typescript": "4.6.3"
  }
}
12:20:48 AM: Build ready to start
12:20:50 AM: build-image version: ac716c5be7f79fe384a0f3759e8ef612cb821a37 (xenial)
12:20:50 AM: build-image tag: v3.13.0
12:20:50 AM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
12:20:51 AM: Fetching cached dependencies
12:20:51 AM: Failed to fetch cache, continuing with build
12:20:51 AM: Starting to prepare the repo for build
12:20:51 AM: No cached dependencies found. Cloning fresh repo
12:20:51 AM: git clone https://github.com/lcskoerner/ng
12:20:53 AM: Preparing Git Reference refs/heads/main
12:20:53 AM: Parsing package.json dependencies
12:20:55 AM: Starting build script
12:20:55 AM: Installing dependencies
12:20:55 AM: Python version set to 2.7
12:20:56 AM: v12.18.0 is already installed.
12:20:57 AM: Now using node v12.18.0 (npm v6.14.4)
12:20:57 AM: Started restoring cached build plugins
12:20:57 AM: Finished restoring cached build plugins
12:20:57 AM: Attempting ruby version 2.7.2, read from environment
12:20:58 AM: Using ruby version 2.7.2
12:20:59 AM: Using PHP version 5.6
12:20:59 AM: Started restoring cached yarn cache
12:20:59 AM: Finished restoring cached yarn cache
12:20:59 AM: No yarn workspaces detected
12:20:59 AM: Started restoring cached node modules
12:20:59 AM: Finished restoring cached node modules
12:21:00 AM: Installing NPM modules using Yarn version 1.22.10
12:21:00 AM: yarn install v1.22.10
12:21:00 AM: [1/4] Resolving packages...
12:21:00 AM: [2/4] Fetching packages...
12:21:14 AM: error next@12.1.5: The engine "node" is incompatible with this module. Expected version ">=12.22.0". Got "12.18.0"
12:21:14 AM: error Found incompatible module.
12:21:14 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
12:21:14 AM: Error during Yarn install
12:21:14 AM: Build was terminated: Build script returned non-zero exit code: 1
12:21:15 AM: Creating deploy upload records
12:21:15 AM: Failing build: Failed to build site
12:21:15 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
12:21:15 AM: Finished processing build request in 24.502983593s

Any help is appreciated. How can I upgrade the node “engine”?

Hey @LLawiet

The build image you are using is running an outdated and incompatible version of Node.js.

Using one of the methods outlined in the Manage Build Dependencies documentation to updated the version of Node.js used is the simplest.
Another option is to deploy a new site using the latest build image which runs Node.js v16. If you are using a custom domain, you could then remove them from the current site and add them to the new site.

If you have any questions, please don’t hesitate to reply.

2 Likes

Hey @coelmay,

I set the NODE_VERSION env variable to 12.22.0 and that worked! Thank you so much.

Can you help me understand:

  1. How can I ‘reset’ the image so it always use the latest version? Giving a little bit of context, I started the project from scratch again so that is the reason all the dependencies were different than what was on Netlify.

  2. I see other runtimes running like Ruby, PHP and Go. We’re not able to develop code in these languages yet correct?

Peace

1 Like

To put it simply, Netlify deploys static websites so cannot deploy Ruby, PHP, [insert other dynamic language…] etc. You can however develop with Go in Netlify functions.
Learn more about that here

1 Like

@kylesloper

Yeah, I get it. I just find it interesting that all the other runtimes are there. I was hoping Netlify would support those anytime in the future :upside_down_face:

Also, the barrier between ‘static’ and dynamic is very blurry right now… We can run NextJS with SSR on Netlify…

Thanks for the article. I’ll check how to deploy serverless functions written in Go

Netlify supports all of these languages at build time, e.g. using Jeykll (Ruby), Cecil (PHP), Hugo (Go), etc. but not at runtime meaning you can’t deploy a PHP contact form.

Basically anything listed here:

Agree, this line seems a little blurry sometimes now. I don’t consider SSR as static, but more akin to PHP.

2 Likes