Repeated deploy failures because of sharp; node version looks wrong

site: davidrhoden.netlify.app (davidrhoden.com)

I’ve had ten or more failed deploys. I had committed a very large video file that wasn’t picked up by LFS, but I think I cleaned that up with BFG. The node module ‘sharp’ seems to be a problem. Here’s an excerpt from my deploy output (full output at end of the post):

6:32:48 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
6:32:48 PM: > sharp@0.29.3 install /opt/build/repo/node_modules/sharp
6:32:48 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
6:32:50 PM: sharp: Installation error: Expected Node.js version >=12.13.0 but found 10.24.1

I have added the environment variable NODE_VERSION with a value of 16. Not sure why it’s finding Node 10.

I am developing on an M1 Mac.

Here’s the full deploy log:

6:31:44 PM: Build ready to start

6:31:47 PM: build-image version: 3fa6e2800752667ac56af498951f923e208f7404 (xenial)

6:31:47 PM: build-image tag: v3.10.3

6:31:47 PM: buildbot version: 8cd320132979d1a1a502e85e77b47b97cc7d659f

6:31:47 PM: Fetching cached dependencies

6:31:47 PM: Failed to fetch cache, continuing with build

6:31:47 PM: Starting to prepare the repo for build

6:31:47 PM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1

6:31:47 PM: No cached dependencies found. Cloning fresh repo

6:31:47 PM: git clone https://github.com/davidrhoden/davidrhoden-basic-netlify

6:31:52 PM: Preparing Git Reference refs/heads/master

6:31:53 PM: Parsing package.json dependencies

6:31:54 PM: Starting build script

6:31:54 PM: Installing dependencies

6:31:54 PM: Python version set to 2.7

6:31:55 PM: Attempting node version '10' from .nvmrc

6:31:55 PM: Downloading and installing node v10.24.1...

6:31:55 PM: Downloading https://nodejs.org/dist/v10.24.1/node-v10.24.1-linux-x64.tar.xz...

6:31:56 PM: Computing checksum with sha256sum

6:31:56 PM: Checksums matched!

6:31:58 PM: Now using node v10.24.1 (npm v6.14.12)

6:31:58 PM: Started restoring cached build plugins

6:31:58 PM: Finished restoring cached build plugins

6:31:59 PM: Attempting ruby version 2.6.2, read from environment

6:32:00 PM: Using ruby version 2.6.2

6:32:00 PM: Using PHP version 5.6

6:32:00 PM: Started restoring cached node modules

6:32:00 PM: Finished restoring cached node modules

6:32:01 PM: Installing NPM modules using NPM version 6.14.12

6:32:48 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

6:32:48 PM: > sharp@0.29.3 install /opt/build/repo/node_modules/sharp

6:32:48 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

6:32:50 PM: sharp: Installation error: Expected Node.js version >=12.13.0 but found 10.24.1

6:32:50 PM: sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/netlify-cli/node_modules/fsevents):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-win32-x64@0.34.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-win32-x64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-win32-x64@0.34.1: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-darwin-x64@0.34.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-darwin-x64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-darwin-x64@0.34.1: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/routing-local-proxy-darwin-arm64@0.34.1 (node_modules/netlify-cli/node_modules/@netlify/routing-local-proxy-darwin-arm64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/routing-local-proxy-darwin-arm64@0.34.1: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-win32-x64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-win32-x64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-win32-x64@1.1.1: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-win32-ia32@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-win32-ia32):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-win32-ia32@1.1.1: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-openbsd-x64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-openbsd-x64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-openbsd-x64@1.1.1: wanted {"os":"openbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-linux-ia32@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-linux-ia32):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-linux-ia32@1.1.1: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-linux-ppc64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-linux-ppc64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-linux-ppc64@1.1.1: wanted {"os":"linux","arch":"ppc64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-linux-arm64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-linux-arm64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-linux-arm64@1.1.1: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-linux-arm@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-linux-arm):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-linux-arm@1.1.1: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-freebsd-x64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-freebsd-x64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-freebsd-x64@1.1.1: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-freebsd-arm64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-freebsd-arm64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-freebsd-arm64@1.1.1: wanted {"os":"freebsd","arch":"arm64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-darwin-x64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-darwin-x64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-darwin-x64@1.1.1: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/local-functions-proxy-darwin-arm64@1.1.1 (node_modules/netlify-cli/node_modules/@netlify/local-functions-proxy-darwin-arm64):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/local-functions-proxy-darwin-arm64@1.1.1: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):

6:32:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

6:32:54 PM: npm ERR! code ELIFECYCLE

6:32:54 PM: npm ERR! errno 1

6:32:54 PM: npm ERR! sharp@0.29.3 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)`

6:32:54 PM: npm ERR! Exit status 1

6:32:54 PM: npm ERR!

6:32:54 PM: npm ERR! Failed at the sharp@0.29.3 install script.

6:32:54 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

6:32:54 PM: npm ERR! A complete log of this run can be found in:

6:32:54 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-01-21T00_32_54_332Z-debug.log

6:32:54 PM: Error during NPM install

6:32:54 PM: Build was terminated: Build script returned non-zero exit code: 1

6:32:54 PM: Creating deploy upload records

6:32:54 PM: Failing build: Failed to build site

6:32:54 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1

6:32:55 PM: Finished processing build request in 1m7.837775106s

Hi @davidrhoden

Because you have an .nvmrc file in the root of the repository (with 10 in it) which is overriding the environment variable.

Remove the file and try deploying again.

thanks, coelmay. Changing that from 10 to 16 solved the issue. It just took ~20 minutes to build. During which time I deleted the file and pushed. I bet it will still work with the file deleted.

Appreciate your fast response.