Home
Support Forums

Netlify fails to build website: incompatibe module expected version >=12

experiencing issues on building branches on netlify
The site’s link is: Netlify App
Its purpose is for staging branches before merging on a separate main site

I am aware that this is a very common problem but so far there is no solution that I have tried that have solved
It just puzzles me that I didnt change anything from the netlify settings or the files’ config to be able to have this problem

Error logs include:

8:43:22 AM: error yargs@17.1.1: The engine “node” is incompatible with this module. Expected version “>=12”. Got “10.24.1”
8:43:22 AM: error Found incompatible module.
8:43:22 AM: info Visithttps://yarnpkg.com/en/docs/cli/install for documentation about this command.
8:43:22 AM: Error during Yarn install
8:43:22 AM: Build was terminated: Build script returned non-zero exit code: 1
8:43:22 AM: Creating deploy upload records
8:43:22 AM: Failing build: Failed to build site
8:43:22 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
8:43:22 AM: Finished processing build request in 1m3.366072801s

Similar problems I have tried solutions on:

I’ve also tried reinstalling node modules and yarn.lock and it still did not resolve the issue.

There is no problem locally as it able to build
Most of these solution end up needing to choose the node version which recommends the docs for managing dependencies

the node version is set on the .nvmrc file, it set to 10. we try to stay away from changing the node version because prior to this issue it is working properly. Setting these options did not solve the issue:

  • Set a NODE_VERSION environment variable.
  • Add a .node-version or .nvmrc file to the site’s base directory in your repository. This will also tell any other developer using the repository which version of Node.js it depends on.

Hi @Kyle-Symph,

How exactly have you set the Node Version? I’m not seeing it being set as an Environment Variable at the moment. Are you using something else?

we have .nvmrc file specified node version 10 on it, ive tried to change it to 12 but it still gives me error a different one, but my coworkers have told me to not change it.

Do you have a deploy log in which you upgraded the version to Node 12 and it still failed?

The last deploy seems to use Node 10. Also, I am confused - your co-workers tell you not to change, you mean not to change from 10 or 12?

for the logs this one I changed the .nvmrc to 12
8:12:04 AM: Build ready to start
8:12:06 AM: build-image version: c6001ed68662a13e5deb24abec2b46058c58248a
8:12:06 AM: build-image tag: v3.9.0
8:12:06 AM: buildbot version: 97a6b2cacb208d0706f4c310f966af375d45e5e6
8:12:06 AM: Fetching cached dependencies
8:12:06 AM: Starting to download cache of 1.4GB
8:12:21 AM: Finished downloading cache in 15.225768764s
8:12:21 AM: Starting to extract cache
8:12:45 AM: Finished extracting cache in 23.512458428s
8:12:45 AM: Finished fetching cache in 39.29683082s
8:12:45 AM: Starting to prepare the repo for build
8:12:46 AM: Preparing Git Reference refs/heads/feature/mktg-51-contact-us-add-upload-file-feature
8:12:52 AM: Parsing package.json dependencies
8:12:52 AM: Different build command detected, going to use the one specified in the Netlify configuration file: ‘eleventy’ versus ‘eleventy build’ in the Netlify UI
8:12:53 AM: Starting build script
8:12:53 AM: Installing dependencies
8:12:53 AM: Python version set to 2.7
8:12:53 AM: Started restoring cached node version
8:12:57 AM: Finished restoring cached node version
8:12:57 AM: Attempting node version ‘12’ from .nvmrc
8:12:58 AM: Downloading and installing node v12.22.6…
8:12:58 AM: Downloading https://nodejs.org/dist/v12.22.6/node-v12.22.6-linux-x64.tar.xz
8:12:58 AM: Computing checksum with sha256sum
8:12:58 AM: Checksums matched!
8:13:01 AM: Now using node v12.22.6 (npm v6.14.15)
8:13:01 AM: Started restoring cached build plugins
8:13:01 AM: Finished restoring cached build plugins
8:13:02 AM: Attempting ruby version 2.7.1, read from environment
8:13:02 AM: Started restoring cached ruby version
8:13:02 AM: Finished restoring cached ruby version
8:13:05 AM: Using ruby version 2.7.1
8:13:05 AM: Using PHP version 5.6
8:13:05 AM: Started restoring cached yarn cache
8:13:11 AM: Finished restoring cached yarn cache
8:13:12 AM: No yarn workspaces detected
8:13:12 AM: Started restoring cached node modules
8:13:12 AM: Finished restoring cached node modules
8:13:12 AM: Installing NPM modules using Yarn version 1.22.4
8:13:13 AM: yarn install v1.22.4
8:13:13 AM: [1/4] Resolving packages…
8:13:14 AM: [2/4] Fetching packages…
8:13:25 AM: info fsevents@2.3.2: The platform “linux” is incompatible with this module.
8:13:25 AM: info “fsevents@2.3.2” is an optional dependency and failed compatibility check. Excluding it from installation.
8:13:25 AM: info fsevents@1.2.13: The platform “linux” is incompatible with this module.
8:13:25 AM: info “fsevents@1.2.13” is an optional dependency and failed compatibility check. Excluding it from installation.
8:13:26 AM: [3/4] Linking dependencies…
8:13:26 AM: warning " > extract-text-webpack-plugin@3.0.2" has incorrect peer dependency “webpack@^3.1.0”.
8:13:34 AM: [4/4] Building fresh packages…
8:13:35 AM: Done in 22.05s.
8:13:35 AM: NPM modules installed using Yarn
8:13:35 AM: Started restoring cached go cache
8:13:35 AM: Finished restoring cached go cache
8:13:35 AM: go version go1.14.4 linux/amd64
8:13:35 AM: go version go1.14.4 linux/amd64
8:13:35 AM: Installing missing commands
8:13:35 AM: Verify run directory
8:13:37 AM: ​
8:13:37 AM: ────────────────────────────────────────────────────────────────
8:13:37 AM: Netlify Build
8:13:37 AM: ────────────────────────────────────────────────────────────────
8:13:37 AM: ​
8:13:37 AM: ❯ Version
8:13:37 AM: @netlify/build 18.12.0
8:13:37 AM: ​
8:13:37 AM: ❯ Flags
8:13:37 AM: baseRelDir: true
8:13:37 AM: buildId: 614a74d3ca8433000788a22b
8:13:37 AM: deployId: 614a74d3ca8433000788a22d
8:13:37 AM: ​
8:13:37 AM: ❯ Current directory
8:13:37 AM: /opt/build/repo
8:13:37 AM: ​
8:13:37 AM: ❯ Config file
8:13:37 AM: /opt/build/repo/netlify.toml
8:13:37 AM: ​
8:13:37 AM: ❯ Context
8:13:37 AM: branch-deploy
8:13:37 AM: ​
8:13:37 AM: ❯ Loading plugins
8:13:37 AM: - netlify-plugin-lazy-load-images@0.3.4 from netlify.toml and package.json
8:13:38 AM: ​
8:13:38 AM: ────────────────────────────────────────────────────────────────
8:13:38 AM: Plugin “netlify-plugin-lazy-load-images” internal error
8:13:38 AM: ────────────────────────────────────────────────────────────────
8:13:38 AM: ​
8:13:38 AM: Error message
8:13:38 AM: Error: Could not import plugin:
8:13:38 AM: The module ‘/opt/build/repo/node_modules/canvas/build/Release/canvas.node’
8:13:38 AM: was compiled against a different Node.js version using
8:13:38 AM: NODE_MODULE_VERSION 64. This version of Node.js requires
8:13:38 AM: NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
8:13:38 AM: the module (for instance, using npm rebuild or npm install).
8:13:38 AM: ​
8:13:38 AM: Plugin details
8:13:38 AM: Package: netlify-plugin-lazy-load-images
8:13:38 AM: Version: 0.3.4
8:13:38 AM: Repository: git+https://github.com/manister/netlify-plugin-lazy-load-images.git
8:13:38 AM: npm link: netlify-plugin-lazy-load-images - npm
8:13:38 AM: Report issues: https://github.com/manister/netlify-plugin-lazy-load-images/issues
8:13:38 AM: ​
8:13:38 AM: Error location
8:13:38 AM: While loading “netlify-plugin-lazy-load-images” from netlify.toml and package.json
8:13:38 AM: at Object.Module._extensions…node (internal/modules/cjs/loader.js:1057:18)
8:13:38 AM: at Module.load (internal/modules/cjs/loader.js:863:32)
8:13:38 AM: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
8:13:38 AM: at Module.require (internal/modules/cjs/loader.js:887:19)
8:13:38 AM: at require (internal/modules/cjs/helpers.js:74:18)
8:13:38 AM: at Object. (/opt/build/repo/node_modules/canvas/lib/bindings.js:3:18)
8:13:38 AM: at Module._compile (internal/modules/cjs/loader.js:999:30)
8:13:38 AM: at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)
8:13:38 AM: at Module.load (internal/modules/cjs/loader.js:863:32)
8:13:38 AM: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
8:13:38 AM: ​
8:13:38 AM: Resolved config
8:13:38 AM: build:
8:13:38 AM: command: eleventy
8:13:38 AM: commandOrigin: config
8:13:38 AM: publish: /opt/build/repo/_site
8:13:38 AM: publishOrigin: config
8:13:38 AM: headers:
8:13:38 AM: - for: /*
values:
cache-control: max-age=10, must-revalidate
headersOrigin: config
plugins:
- inputs: {}
origin: config
package: netlify-plugin-lazy-load-images
Caching artifacts
8:13:38 AM: Started saving node modules
8:13:38 AM: Finished saving node modules
8:13:38 AM: Started saving build plugins
8:13:38 AM: Finished saving build plugins
8:13:38 AM: Started saving yarn cache
8:13:46 AM: Finished saving yarn cache
8:13:46 AM: Started saving pip cache
8:13:46 AM: Finished saving pip cache
8:13:46 AM: Started saving emacs cask dependencies
8:13:46 AM: Finished saving emacs cask dependencies
8:13:46 AM: Started saving maven dependencies
8:13:46 AM: Finished saving maven dependencies
8:13:46 AM: Started saving boot dependencies
8:13:47 AM: Finished saving boot dependencies
8:13:47 AM: Started saving rust rustup cache
8:13:47 AM: Finished saving rust rustup cache
8:13:47 AM: Started saving go dependencies
8:13:47 AM: Finished saving go dependencies
8:13:51 AM: Build failed due to a plugin error: Build script returned non-zero exit code: 3
8:13:51 AM: Creating deploy upload records
8:13:52 AM: Failing build: Failed to build site
8:13:52 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 3
8:13:52 AM: Finished processing build request in 1m45.900786819s

I have also tried to change the NODE VERSION in the environment variable to 12 but it just produced the same error logs from my main question

for the last question. Yes he told me not to change the node version to 12.
we wanted to know why it is requiring version 12 even before it doesn’t need to be.

The answer to this would be, don’t use Yarn. Yarn needs Node 12, if you want to stay with Node 10, Yarn is not an option for you.

As far as the build log is concerned with Node 12, it’s a completely different error than what you’re getting with Node 10.

Have you tried doing what it’s saying?

thank you I will consult it with other devs on my team.

As for this one

As far as the build log is concerned with Node 12, it’s a completely different error than what you’re getting with Node 10.
Have you tried doing what it’s saying?

I dont have full control to modify the site config that is why I havent really tried to fix the site on version 12.

There’s not a lot you need to modify. At least for testing, you could simply change your build command to nom rebuild && npm run build

hi @hrishikesh thank you for your responses sorry I am not able to reply as fast because I dont have much knowledge on this im on internship and I always have to tell first to other devs before I can do something.
I may still ask questions in the following days, for now they are working on it as I update them on your response on this issue.

No problem. Let us know how things develop.

hi sorry again for the late reply we have fixed the issue by migrating to npm as it only requires version 10 thanks!

Hey there, @Kyle-Symph :wave:

Glad to know that everything is up and working now! Thanks for sharing the steps you took here, it will be beneficial for future members who encounter something similar. :netliconfetti:

1 Like