Command failed with exit code 127 (Nuxt)

When deploying the build script exit’s with a non-zero exit code 127. “Nuxi not found”.

I already tried upgrading all versions to the latest available one, but it didn’t help as expected.
Previous commits worked just fine.

10:42:18 AM: build-image version: 3796fbb97a2096ccb5f2393f5b3a7c48c237b2b0 (focal)
10:42:18 AM: buildbot version: 3796fbb97a2096ccb5f2393f5b3a7c48c237b2b0
10:42:18 AM: Fetching cached dependencies
10:42:18 AM: Starting to download cache of 768.0MB
10:42:34 AM: Finished downloading cache in 15.591s
10:42:34 AM: Starting to extract cache
10:42:39 AM: Finished extracting cache in 5.039s
10:42:39 AM: Finished fetching cache in 20.724s
10:42:39 AM: Starting to prepare the repo for build
10:42:39 AM: Preparing Git Reference refs/heads/main
10:42:41 AM: Starting to install dependencies
10:42:41 AM: Python version set to 3.8
10:42:41 AM: Attempting Ruby version 2.7.2, read from environment
10:42:42 AM: Using Ruby version 2.7.2
10:42:42 AM: Started restoring cached go cache
10:42:42 AM: Finished restoring cached go cache
10:42:42 AM: go version go1.19.13 linux/amd64
10:42:43 AM: Using PHP version 8.0
10:42:43 AM: Started restoring cached Node.js version
10:42:44 AM: Finished restoring cached Node.js version
10:42:45 AM: v18.18.0 is already installed.
10:42:45 AM: Now using node v18.18.0 (npm v9.8.1)
10:42:45 AM: Enabling Node.js Corepack
10:42:45 AM: Started restoring cached build plugins
10:42:45 AM: Finished restoring cached build plugins
10:42:45 AM: WARNING: The environment variable "NODE_ENV" is set to "production". Any "devDependencies" in package.json will not be installed
10:42:45 AM: Started restoring cached corepack dependencies
10:42:45 AM: Finished restoring cached corepack dependencies
10:42:45 AM: Started restoring cached yarn cache
10:42:48 AM: Finished restoring cached yarn cache
10:42:48 AM: No yarn workspaces detected
10:42:48 AM: Started restoring cached node modules
10:42:48 AM: Finished restoring cached node modules
10:42:48 AM: Installing npm packages using Yarn version 1.22.19
10:42:48 AM: yarn install v1.22.19
10:42:49 AM: [1/5] Validating package.json...
10:42:49 AM: [2/5] Resolving packages...
10:42:49 AM: [3/5] Fetching packages...
10:42:58 AM: warning vscode-languageclient@7.0.0: The engine "vscode" appears to be invalid.
10:42:58 AM: [4/5] Linking dependencies...
10:42:58 AM: warning "@pinia/nuxt > pinia@2.1.6" has unmet peer dependency "vue@^2.6.14 || ^3.3.0".
10:42:58 AM: warning "@pinia/nuxt > pinia > vue-demi@0.14.6" has unmet peer dependency "vue@^3.0.0-0 || ^2.6.0".
10:42:58 AM: warning " > vue-i18n@9.5.0" has unmet peer dependency "vue@^3.0.0".
10:42:58 AM: warning "@nuxtjs/tailwindcss > @nuxt/postcss8 > css-loader@5.2.7" has unmet peer dependency "webpack@^4.27.0 || ^5.0.0".
10:42:58 AM: warning "@nuxtjs/tailwindcss > @nuxt/postcss8 > postcss-loader@4.3.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
10:42:58 AM: warning " > stylelint-config-prettier@9.0.5" has incorrect peer dependency "stylelint@>= 11.x < 15".
10:42:58 AM: warning "stylelint-config-recommended-scss > postcss-scss@4.0.9" has unmet peer dependency "postcss@^8.4.29".
10:42:58 AM: warning " > stylelint-config-recommended-vue@1.5.0" has unmet peer dependency "postcss-html@^1.0.0".
10:42:58 AM: warning "stylelint-config-recommended-vue > stylelint-config-html@1.1.0" has unmet peer dependency "postcss-html@^1.0.0".
10:43:00 AM: [5/5] Building fresh packages...
10:43:02 AM: Done in 13.87s.
10:43:02 AM: npm packages installed using Yarn
10:43:03 AM: Install dependencies script success
10:43:03 AM: Starting build script
10:43:04 AM: Detected 1 framework(s)
10:43:04 AM: "nuxt" at version "3.7.4"
10:43:04 AM: Section completed: initializing
10:43:05 AM: ​
10:43:05 AM: Netlify Build                                                 
10:43:05 AM: ────────────────────────────────────────────────────────────────
10:43:05 AM: ​
10:43:05 AM: ❯ Version
10:43:05 AM:   @netlify/build 29.22.0
10:43:05 AM: ​
10:43:05 AM: ❯ Flags
10:43:05 AM:   baseRelDir: true
10:43:05 AM:   buildId: 65250e69104c1800082fcd0a
10:43:05 AM:   deployId: 65250e69104c1800082fcd0c
10:43:05 AM: ​
10:43:05 AM: ❯ Current directory
10:43:05 AM:   /opt/build/repo
10:43:05 AM: ​
10:43:05 AM: ❯ Config file
10:43:05 AM:   No config file was defined: using default values.
10:43:05 AM: ​
10:43:05 AM: ❯ Context
10:43:05 AM:   production
10:43:05 AM: ​
10:43:05 AM: Build command from Netlify app                                
10:43:05 AM: ────────────────────────────────────────────────────────────────
10:43:05 AM: ​
10:43:05 AM: $ yarn build
10:43:05 AM: yarn run v1.22.19
10:43:05 AM: $ nuxi build
10:43:05 AM: /bin/sh: 1: nuxi: not found
10:43:06 AM: error Command failed with exit code 127. (https://ntl.fyi/exit-code-127)
10:43:06 AM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:43:06 AM: ​
10:43:06 AM: "build.command" failed                                        
10:43:06 AM: ────────────────────────────────────────────────────────────────
10:43:06 AM: ​
10:43:06 AM:   Error message
10:43:06 AM:   Command failed with exit code 127: yarn build (https://ntl.fyi/exit-code-127)
10:43:06 AM: ​
10:43:06 AM:   Error location
10:43:06 AM:   In Build command from Netlify app:
10:43:06 AM:   yarn build
10:43:06 AM: ​
10:43:06 AM:   Resolved config
10:43:06 AM:   build:
10:43:06 AM:     command: yarn build
10:43:06 AM:     commandOrigin: ui
10:43:06 AM:     environment:
10:43:06 AM:       - CONTENT_VERSION
10:43:06 AM:       - DEFAULT_LANG
10:43:06 AM:       - DOMAIN
10:43:06 AM:       - NODE_ENV
10:43:06 AM:       - STORYBLOK_API_KEY
10:43:06 AM:     publish: /opt/build/repo/dist
10:43:06 AM:     publishOrigin: ui
10:43:06 AM: Caching artifacts
10:43:06 AM: Started saving node modules
10:43:06 AM: Finished saving node modules
10:43:06 AM: Started saving build plugins
10:43:06 AM: Finished saving build plugins
10:43:06 AM: Started saving corepack cache
10:43:06 AM: Finished saving corepack cache
10:43:06 AM: Started saving yarn cache
10:43:10 AM: Failed during stage "building site": Build script returned non-zero exit code: 2
10:43:10 AM: Finished saving yarn cache
10:43:10 AM: Started saving pip cache
10:43:10 AM: Finished saving pip cache
10:43:10 AM: Started saving emacs cask dependencies
10:43:10 AM: Finished saving emacs cask dependencies
10:43:10 AM: Started saving maven dependencies
10:43:10 AM: Finished saving maven dependencies
10:43:10 AM: Started saving boot dependencies
10:43:10 AM: Finished saving boot dependencies
10:43:10 AM: Started saving rust rustup cache
10:43:10 AM: Finished saving rust rustup cache
10:43:10 AM: Started saving go dependencies
10:43:10 AM: Finished saving go dependencies
10:43:10 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:43:10 AM: Failing build: Failed to build site
10:43:11 AM: Finished processing build request in 52.668s

Hey @rxs, is “nuxi” in your package.json file listed under dependencies or devDependencies?

Nope it isn’t. Neither it is on develop - where the build works.

@rxs I’d try adding it to your dependencies

But that doesn’t make sense at all. Branch deploys are working without a problem and there is no dependency called “nuxi” in the package.json. Because it’s a CLI Tool to build a Nuxt Project.

Well, does it make sense if Netlify doesn’t have the Nuxt CLI installed? It’s still a production deploy which you’re trying to do, but branch deploys are development deploys?

I’d still give it a try, had some similiar issues like this, but not with “nuxi” specifically though.

Gr,

Andy