Working local build failing here; deploy not honoring NODE_VERSION env variable

My site builds fine on my local machine (M1 Mac) but not at all on Netlify.
I have my NODE_VERSION env variable set to 16, but deploy is loading node 10.

1:54:42 AM: Attempting Node.js version ‘10’ from .nvmrc
1:54:42 AM: Downloading and installing node v10.24.1…
1:54:42 AM: Downloading https://nodejs.org/dist/v10.24.1/node-v10.24.1-linux-x64.tar.xz

Here’s as much of the deploy message is it will let me post:

Deploy log

1:54:23 AM: build-image version: 340a5296c836ef3d99ac1d871c6447bb7a417c33 (focal)
1:54:23 AM: buildbot version: 20d735efc756356fd09bbc43982bef2018461b10
1:54:23 AM: Building without cache
1:54:23 AM: Starting to prepare the repo for build
1:54:23 AM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
1:54:23 AM: No cached dependencies found. Cloning fresh repo
1:54:23 AM: git clone --filter=blob:none https://github.com/davidrhoden/happening-eleventy
1:54:23 AM: Preparing Git Reference refs/heads/master
1:54:24 AM: Parsing package.json dependencies
1:54:25 AM:

❯ Initial build environment
baseRelDir: true
branch: master
context: production
cwd: /opt/build/repo
featureFlags:
mode: buildbot
repositoryRoot: /opt/build/repo
siteId: 0b19e4ad-1c47-4e8c-9a73-d4f7e9141440

❯ UI build settings
baseRelDir: true
build:
command: eleventy
environment:

  • NETLIFY_BUILD_DEBUG
  • NETLIFY_LFS_ORIGIN_URL
  • NODE_VERSION
    publish: _site
    plugins:
  • inputs: {}
    package: ‘@netlify/plugin-lighthouse’

    ❯ Resolved build environment
    branch: master
    buildDir: /opt/build/repo
    configPath: /opt/build/repo/netlify.toml
    context: production
    env:

    ❯ Resolved config
    build:
    command: eleventy
    commandOrigin: config
    environment:
  • NETLIFY_BUILD_DEBUG
  • NETLIFY_LFS_ORIGIN_URL
  • NODE_VERSION
    publish: /opt/build/repo/_site
    publishOrigin: config
    plugins:
  • inputs: {}
    origin: ui
    package: ‘@netlify/plugin-lighthouse’
    1:54:26 AM: Starting to install dependencies
    1:54:26 AM: Python version set to 3.8
    1:54:26 AM: Attempting Ruby version 2.7.1, read from environment
    1:54:26 AM: Required ruby-2.7.1 is not installed - installing.
    1:54:26 AM: Searching for binary rubies, this might take some time.
    1:54:26 AM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.7.1.tar.bz2
    1:54:26 AM: Checking requirements for ubuntu.
    1:54:27 AM: Requirements installation successful.
    1:54:27 AM: ruby-2.7.1 - #configure
    1:54:27 AM: ruby-2.7.1 - #download
    1:54:27 AM: ruby-2.7.1 - #validate archive
    1:54:32 AM: ruby-2.7.1 - #extract
    1:54:34 AM: ruby-2.7.1 - #validate binary
    1:54:35 AM: ruby-2.7.1 - #setup
    1:54:35 AM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1@global
    1:54:35 AM: ruby-2.7.1 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems…
    1:54:35 AM: ruby-2.7.1 - #generating global wrappers…
    1:54:35 AM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1
    1:54:35 AM: ruby-2.7.1 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
    1:54:36 AM: ruby-2.7.1 - #generating default wrappers…
    1:54:36 AM: Using /opt/buildhome/.rvm/gems/ruby-2.7.1
    1:54:36 AM: Using Ruby version 2.7.1
    1:54:36 AM: Started restoring cached go cache
    1:54:36 AM: Finished restoring cached go cache
    1:54:36 AM: Installing Go version 1.19.5 (requested 1.19.5)
    1:54:41 AM: go version go1.19.5 linux/amd64
    1:54:41 AM: Using PHP version 8.0
    1:54:42 AM: Attempting Node.js version ‘10’ from .nvmrc
    1:54:42 AM: Downloading and installing node v10.24.1…
    1:54:42 AM: Downloading https://nodejs.org/dist/v10.24.1/node-v10.24.1-linux-x64.tar.xz
    1:54:42 AM: Computing checksum with sha256sum
    1:54:43 AM: Checksums matched!
    1:54:44 AM: Now using node v10.24.1 (npm v6.14.12)
    1:54:44 AM: Started restoring cached build plugins
    1:54:44 AM: Finished restoring cached build plugins
    1:54:44 AM: Started restoring cached corepack dependencies
    1:54:44 AM: Finished restoring cached corepack dependencies
    1:54:44 AM: jq: error (at :68): Cannot iterate over null (null)
    1:54:44 AM: No npm workspaces detected
    1:54:44 AM: Started restoring cached node modules
    1:54:44 AM: Finished restoring cached node modules
    1:54:44 AM: Installing npm packages using npm version 6.14.12
    1:54:47 AM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@3. I’ll try to do my best with it!
    npm WARN deprecated string-similarity@4.0.4: Package no longer supported. Contact Support at npm | Support for more info.
    1:54:54 AM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
    1:55:02 AM: npm WARN deprecated source-map-resolve@0.5.3: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
    1:55:02 AM: npm WARN deprecated source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
    1:55:02 AM: npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
    1:55:02 AM: npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
    1:55:25 AM: > unix-dgram@2.0.6 install /opt/build/repo/node_modules/netlify-cli/node_modules/unix-dgram
    1:55:25 AM: > node-gyp rebuild
    1:55:25 AM: make: Entering directory ‘/opt/build/repo/node_modules/netlify-cli/node_modules/unix-dgram/build’
    1:55:25 AM: CXX(target) Release/obj.target/unix_dgram/src/unix_dgram.o
    1:55:26 AM: In file included from …/…/nan/nan.h:60,
    1:55:26 AM: from …/src/unix_dgram.cc:5:
    1:55:26 AM: /opt/buildhome/.cache/node-gyp/10.24.1/include/node/node.h:573:43: warning: cast between incompatible function types from ‘void ()(v8::Localv8::Object)’ to ‘node::addon_register_func’ {aka ‘void ()(v8::Localv8::Object, v8::Localv8::Value, void*)’} [-Wcast-function-type]
    1:55:26 AM: 573 | (node::addon_register_func) (regfunc),
    1:55:26 AM: | ^
    1:55:26 AM: /opt/buildhome/.cache/node-gyp/10.24.1/include/node/node.h:607:3: note: in expansion of macro ‘NODE_MODULE_X’
    1:55:26 AM: 607 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
    1:55:26 AM: | ^~~~~~~~~~~~~
    1:55:26 AM: …/src/unix_dgram.cc:404:1: note: in expansion of macro ‘NODE_MODULE’
    1:55:26 AM: 404 | NODE_MODULE(unix_dgram, Initialize)
    1:55:26 AM: | ^~~~~~~~~~~
    1:55:26 AM: In file included from /opt/buildhome/.cache/node-gyp/10.24.1/include/node/node.h:63,
    1:55:26 AM: from …/…/nan/nan.h:60,
    1:55:26 AM: from …/src/unix_dgram.cc:5:
    1:55:26 AM: /opt/buildhome/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P*, typename v8::WeakCallbackInfo

    ::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

    ::Callback = void ()(const v8::WeakCallbackInfonode::ObjectWrap&)]’:
    1:55:26 AM: /opt/buildhome/.cache/node-gyp/10.24.1/include/node/node_object_wrap.h:84:78: required from here
    1:55:26 AM: /opt/buildhome/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfonode::ObjectWrap::Callback’ {aka ‘void (
    )(const v8::WeakCallbackInfonode::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
    1:55:26 AM: 9502 | reinterpret_cast(callback), type);
    1:55:26 AM: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1:55:26 AM: /opt/buildhome/.cache/node-gyp/10.24.1/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P
    , typename v8::WeakCallbackInfo

    ::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

    ::Callback = void ()(const v8::WeakCallbackInfoNan::ObjectWrap&)]’:
    1:55:26 AM: …/…/nan/nan_object_wrap.h:65:61: required from here
    1:55:26 AM: /opt/buildhome/.cache/node-gyp/10.24.1/include/node/v8.h:9502:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfoNan::ObjectWrap::Callback’ {aka ‘void (
    )(const v8::WeakCallbackInfoNan::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
    1:55:26 AM: SOLINK_MODULE(target) Release/obj.target/unix_dgram.node
    1:55:27 AM: COPY Release/unix_dgram.node
    1:55:27 AM: make: Leaving directory ‘/opt/build/repo/node_modules/netlify-cli/node_modules/unix-dgram/build’
    1:55:27 AM: > sharp@0.30.7 install /opt/build/repo/node_modules/sharp
    1:55:27 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
    1:55:28 AM: sharp: Installation error: Expected Node.js version >=12.13.0 but found 10.24.1
    1:55:28 AM: sharp: Please see sharp - High performance Node.js image processing for required dependencies
    1:55:31 AM: npm WARN notsup Unsupported engine for @11ty/eleventy-upgrade-help@2.0.5: wanted: {“node”:“>=14”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: @11ty/eleventy-upgrade-help@2.0.5
    1:55:31 AM: npm WARN notsup Unsupported engine for sharp@0.30.7: wanted: {“node”:“>=12.13.0”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: sharp@0.30.7
    1:55:31 AM: npm WARN notsup Unsupported engine for netlify-cli@12.14.0: wanted: {“node”:“^14.16.0 || >=16.0.0”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: netlify-cli@12.14.0
    1:55:31 AM: npm WARN notsup Unsupported engine for color@4.2.3: wanted: {“node”:“>=12.5.0”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: color@4.2.3
    1:55:31 AM: npm WARN notsup Unsupported engine for @11ty/eleventy@2.0.1: wanted: {“node”:“>=14”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: Failed during stage ‘Install dependencies’: dependency_installation script returned non-zero exit code: 1
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: @11ty/eleventy@2.0.1
    1:55:31 AM: npm WARN notsup Unsupported engine for luxon@2.5.2: wanted: {“node”:“>=12”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: luxon@2.5.2
    1:55:31 AM: npm WARN notsup Unsupported engine for @11ty/eleventy-utils@1.0.1: wanted: {“node”:“>=12”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: @11ty/eleventy-utils@1.0.1
    1:55:31 AM: npm WARN notsup Unsupported engine for @11ty/lodash-custom@4.17.21: wanted: {“node”:“>=14”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: @11ty/lodash-custom@4.17.21
    1:55:31 AM: npm WARN notsup Unsupported engine for @11ty/eleventy-dev-server@1.0.4: wanted: {“node”:“>=14”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: @11ty/eleventy-dev-server@1.0.4
    1:55:31 AM: npm WARN notsup Unsupported engine for liquidjs@10.7.1: wanted: {“node”:“>=14”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: liquidjs@10.7.1
    1:55:31 AM: npm WARN notsup Unsupported engine for luxon@3.3.0: wanted: {“node”:“>=12”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: luxon@3.3.0
    1:55:31 AM: npm WARN notsup Unsupported engine for posthtml@0.16.6: wanted: {“node”:“>=12.0.0”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: posthtml@0.16.6
    1:55:31 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
    1:55:31 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
    1:55:31 AM: npm WARN notsup Unsupported engine for commander@10.0.1: wanted: {“node”:“>=14”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: commander@10.0.1
    1:55:31 AM: npm WARN notsup Unsupported engine for posthtml-parser@0.11.0: wanted: {“node”:“>=12”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: posthtml-parser@0.11.0
    1:55:31 AM: npm WARN notsup Unsupported engine for posthtml-render@3.0.0: wanted: {“node”:“>=12”} (current: {“node”:“10.24.1”,“npm”:“6.14.12”})
    1:55:31 AM: npm WARN notsup Not compatible with your version of node/npm: posthtml-render@3.0.0
    1:55:31 AM: npm WARN markdown-it-anchor@8.6.7 requires a peer of @types/markdown-it@
    but none is installed. You must install peer dependencies yourself.
    1:55:31 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/netlify-cli/node_modules/fsevents):
    1:55:31 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
    1:55:31 AM: 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):
    1:55:31 AM: 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”})
    1:55:31 AM: 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):
    1:55:31 AM: 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”})

… another hundred or more optional dependencies skipped…

1:55:31 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/android-arm@0.16.17 (node_modules/netlify-cli/node_modules/@esbuild/android-arm):
1:55:31 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/android-arm@0.16.17: wanted {“os”:“android”,“arch”:“arm”} (current: {“os”:“linux”,“arch”:“x64”})
1:55:31 AM: npm ERR! code ELIFECYCLE
1:55:31 AM: npm ERR! errno 1
1:55:31 AM: npm ERR! sharp@0.30.7 install: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
1:55:31 AM: npm ERR! Exit status 1
1:55:31 AM: npm ERR!
1:55:31 AM: npm ERR! Failed at the sharp@0.30.7 install script.
1:55:31 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:55:31 AM: npm ERR! A complete log of this run can be found in:
1:55:31 AM: npm ERR! /opt/buildhome/.npm/_logs/2023-05-13T06_55_31_515Z-debug.log

It would appear there is a .nvmrc file in the repository with the value of 10 which is overriding the NODE_VERSION environment variable.

Remove the file if you wish to use the variable, or change the value in the file to 16 and remove the environment variable.

1 Like