Command Failed with exit code 1

Netlify has been chugging along just fine for us but now that Nuxt 3 has updated to RC1 we’re having a tough time building properly on Netlify. Here’s the most recent error we’re having.

  • Site name: beta.tabs.to
  • Build log below:

Deploy failed

Build ready to start

4:42:17 PM: Fetching cached dependencies
4:42:17 PM: Starting to download cache of 177.9MB
4:42:23 PM: Finished downloading cache in 6.136846679s
4:42:23 PM: Starting to extract cache
4:42:28 PM: Finished extracting cache in 4.648187788s
4:42:28 PM: Finished fetching cache in 10.808986388s
4:42:28 PM: Starting to prepare the repo for build
4:42:28 PM: Preparing Git Reference refs/heads/main
4:42:29 PM: Parsing package.json dependencies
4:42:30 PM: Starting build script
4:42:30 PM: Installing dependencies
4:42:30 PM: Python version set to 2.7
4:42:30 PM: Started restoring cached node version
4:42:31 PM: Finished restoring cached node version
4:42:31 PM: v16.14.2 is already installed.
4:42:32 PM: Now using node v16.14.2 (npm v8.5.0)
4:42:32 PM: Started restoring cached build plugins
4:42:32 PM: Finished restoring cached build plugins
4:42:32 PM: Attempting ruby version 2.7.2, read from environment
4:42:33 PM: Using ruby version 2.7.2
4:42:33 PM: Using PHP version 8.0
4:42:34 PM: No npm workspaces detected
4:42:34 PM: Started restoring cached node modules
4:42:34 PM: Finished restoring cached node modules
4:42:34 PM: Started restoring cached go cache
4:42:34 PM: Finished restoring cached go cache
4:42:34 PM: go version go1.16.5 linux/amd64
4:42:34 PM: go version go1.16.5 linux/amd64
4:42:34 PM: Installing missing commands
4:42:34 PM: Verify run directory
4:42:35 PM: ​
4:42:35 PM: ────────────────────────────────────────────────────────────────
4:42:35 PM: Netlify Build
4:42:35 PM: ────────────────────────────────────────────────────────────────
4:42:35 PM: ​
4:42:35 PM: ❯ Version
4:42:35 PM: @netlify/build 27.0.1
4:42:35 PM: ​
4:42:35 PM: ❯ Flags
4:42:35 PM: baseRelDir: true
4:42:35 PM: buildId: 62633d57343e8b000817c30e
4:42:35 PM: deployId: 62633d57343e8b000817c310
4:42:35 PM: ​
4:42:35 PM: ❯ Current directory
4:42:35 PM: /opt/build/repo
4:42:35 PM: ​
4:42:35 PM: ❯ Config file
4:42:35 PM: /opt/build/repo/netlify.toml
4:42:35 PM: ​
4:42:35 PM: ❯ Context
4:42:35 PM: production
4:42:35 PM: ​
4:42:35 PM: ────────────────────────────────────────────────────────────────
4:42:35 PM: 1. build.command from netlify.toml
4:42:35 PM: ────────────────────────────────────────────────────────────────
4:42:35 PM: ​
4:42:35 PM: $ nuxt build
4:42:35 PM: [log] Nuxt CLI v3.0.0-rc.1
4:42:40 PM: [info] [nuxt:tailwindcss] Using Tailwind CSS from ~/assets/css/tailwind.scss
4:42:40 PM: [info] [nuxt:tailwindcss] Merging Tailwind config from ~/tailwind.config.js
4:42:40 PM: [log] [@nuxtjs/algolia] Module loaded correctly :rocket:
4:42:53 PM: [info] Vite client warmed up in 12511ms
4:43:02 PM: [warn]
4:43:02 PM: (!) Some chunks are larger than 500 KiB after minification. Consider:
4:43:02 PM: - Using dynamic import() to code-split the application
4:43:02 PM: - Use build.rollupOptions.output.manualChunks to improve chunking: rollup.js
4:43:02 PM: - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
4:43:02 PM: [info] Client built in 21068ms
4:43:02 PM: [info] Building server…
4:43:09 PM: [success] Server built in 6776ms
4:43:09 PM: [error] ENOENT: no such file or directory, mkdir ‘/opt/build/repo/dist’
4:43:09 PM: ​
4:43:09 PM: ────────────────────────────────────────────────────────────────
4:43:09 PM: “build.command” failed
4:43:09 PM: ────────────────────────────────────────────────────────────────
4:43:09 PM: ​
4:43:09 PM: Error message
4:43:09 PM: Command failed with exit code 1: nuxt build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
4:43:09 PM: ​
4:43:09 PM: Error location
4:43:09 PM: In build.command from netlify.toml:
4:43:09 PM: nuxt build
4:43:09 PM: ​
4:43:09 PM: Resolved config
4:43:09 PM: build:
4:43:09 PM: command: nuxt build
4:43:10 PM: Creating deploy upload records
4:43:09 PM: commandOrigin: config
4:43:09 PM: environment:
4:43:09 PM: - ALGOLIA_APPLICATION_ID
4:43:09 PM: - ALGOLIA_SEARCH_API_KEY
4:43:09 PM: - ENV
4:43:09 PM: - FIREBASE_API_KEY
4:43:10 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
4:43:09 PM: - FIREBASE_APP_ID
4:43:09 PM: - FIREBASE_AUTH_DOMAIN
4:43:09 PM: - FIREBASE_MEASUREMENT_ID
4:43:09 PM: - FIREBASE_MESSAGING_SENDER_ID
4:43:09 PM: - FIREBASE_PROJECT_ID
4:43:09 PM: - FIREBASE_STORAGE_BUCKET
4:43:09 PM: - SENTRY_DSN
4:43:09 PM: publish: /opt/build/repo/dist
4:43:09 PM: publishOrigin: config
4:43:09 PM: functionsDirectory: /opt/build/repo/netlify/functions
4:43:09 PM: Caching artifacts
4:43:09 PM: Started saving node modules
4:43:09 PM: Finished saving node modules
4:43:09 PM: Started saving build plugins
4:43:09 PM: Finished saving build plugins
4:43:09 PM: Started saving pip cache
4:43:10 PM: Finished saving pip cache
4:43:10 PM: Started saving emacs cask dependencies
4:43:10 PM: Finished saving emacs cask dependencies
4:43:10 PM: Started saving maven dependencies
4:43:10 PM: Finished saving maven dependencies
4:43:10 PM: Started saving boot dependencies
4:43:10 PM: Finished saving boot dependencies
4:43:10 PM: Started saving rust rustup cache
4:43:10 PM: Finished saving rust rustup cache
4:43:10 PM: Started saving go dependencies
4:43:10 PM: Finished saving go dependencies
4:43:10 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:43:10 PM: Failing build: Failed to build site
4:43:10 PM: Finished processing build request in 52.896034429s

Hey @shellen,

It looks like you got a successful deploy yesterday. Have you figured this out?

1 Like

Curious to hear if this got sorted out here as well. All my Nuxt 2 sites work like a charm but trying to learn some Nuxt 3 and hitting the same wall.

[error] ENOENT: no such file or directory, mkdir '/opt/build/repo/dist'

I did notice when trying the build script locally that dist is a symlink to .output/public, not sure if that might be part of what’s going on.

1 Like

Yeah, getting the same error deploying the nuxt 3 rc, curious how to debug this

Hey there, @MRaichelson and @emdahlstrom :wave:

Thanks so much for your patience here. The support team has been a bit underwater this week and it has impacted our response times. Can you please share a URL to the sites that are impacted by this, as well as the most recent build log?

I’m also having this same issue trying to deploy a Nuxt 3 repo — not having any luck getting past it.

Hi @hillary, sorry about being a bit slow to reply here, missed this.

The url to our nuxt 3 app is here: https://calm-pavlova-f40ed2.netlify.app

10:31:50 AM: Build ready to start
10:31:52 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
10:31:52 AM: build-image tag: v4.8.0
10:31:52 AM: buildbot version: a018caed2ab46726023e1532e0d3214727318b1c
10:31:52 AM: Fetching cached dependencies
10:31:52 AM: Starting to download cache of 1.4MB
10:31:52 AM: Finished downloading cache in 140.246895ms
10:31:52 AM: Starting to extract cache
10:31:52 AM: Finished extracting cache in 19.08126ms
10:31:52 AM: Finished fetching cache in 159.806057ms
10:31:52 AM: Starting to prepare the repo for build
10:31:53 AM: Preparing Git Reference refs/heads/main
10:31:54 AM: Parsing package.json dependencies
10:31:55 AM: Starting build script
10:31:55 AM: Installing dependencies
10:31:55 AM: Python version set to 2.7
10:31:55 AM: Attempting node version '16' from .nvmrc
10:31:56 AM: Downloading and installing node v16.15.0...
10:31:56 AM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz...
10:31:57 AM: Computing checksum with sha256sum
10:31:57 AM: Checksums matched!
10:32:00 AM: Now using node v16.15.0 (npm v8.5.5)
10:32:00 AM: Started restoring cached build plugins
10:32:00 AM: Finished restoring cached build plugins
10:32:00 AM: Attempting ruby version 2.7.2, read from environment
10:32:01 AM: Using ruby version 2.7.2
10:32:02 AM: Using PHP version 8.0
10:32:02 AM: No npm workspaces detected
10:32:02 AM: Started restoring cached node modules
10:32:02 AM: Finished restoring cached node modules
10:32:02 AM: Installing NPM modules using NPM version 8.5.5
10:32:35 AM: added 921 packages, and audited 922 packages in 32s
10:32:35 AM: 137 packages are looking for funding
10:32:35 AM:   run `npm fund` for details
10:32:35 AM: found 0 vulnerabilities
10:32:35 AM: NPM modules installed
10:32:35 AM: Started restoring cached go cache
10:32:35 AM: Finished restoring cached go cache
10:32:35 AM: go version go1.16.5 linux/amd64
10:32:35 AM: go version go1.16.5 linux/amd64
10:32:35 AM: Installing missing commands
10:32:35 AM: Verify run directory
10:32:37 AM: ​
10:32:37 AM: ────────────────────────────────────────────────────────────────
10:32:37 AM:   Netlify Build                                                 
10:32:37 AM: ────────────────────────────────────────────────────────────────
10:32:37 AM: ​
10:32:37 AM: ❯ Version
10:32:37 AM:   @netlify/build 27.0.2
10:32:37 AM: ​
10:32:37 AM: ❯ Flags
10:32:37 AM:   baseRelDir: true
10:32:37 AM:   buildId: 6270e876e13ffd00098c6ef5
10:32:37 AM:   deployId: 6270e876e13ffd00098c6ef7
10:32:37 AM: ​
10:32:37 AM: ❯ Current directory
10:32:37 AM:   /opt/build/repo
10:32:37 AM: ​
10:32:37 AM: ❯ Config file
10:32:37 AM:   /opt/build/repo/netlify.toml
10:32:37 AM: ​
10:32:37 AM: ❯ Context
10:32:37 AM:   production
10:32:37 AM: ​
10:32:37 AM: ────────────────────────────────────────────────────────────────
10:32:37 AM:   1. Build command from Netlify app                             
10:32:37 AM: ────────────────────────────────────────────────────────────────
10:32:37 AM: ​
10:32:37 AM: $ npm run build
10:32:38 AM: > build
10:32:38 AM: > nuxi generate
10:32:38 AM: [log] Nuxt CLI v3.0.0-rc.2
10:32:44 AM: [info] [nuxt:tailwindcss] Merging Tailwind config from ~/tailwind.config.js
10:32:49 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
10:32:49 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
10:32:49 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
10:32:49 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
10:32:49 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
10:32:49 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
10:32:49 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
10:32:50 AM: [warn] Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification (repeated 72 times)
10:32:50 AM: [info] Vite client warmed up in 5408ms
10:32:50 AM: [info] Client built in 5552ms
10:32:50 AM: [info] Building server...
10:32:52 AM: [success] Server built in 1359ms
10:32:52 AM: [error] ENOENT: no such file or directory, mkdir '/opt/build/repo/dist'
10:32:52 AM: ​
10:32:52 AM: ────────────────────────────────────────────────────────────────
10:32:52 AM:   "build.command" failed                                        
10:32:52 AM: ────────────────────────────────────────────────────────────────
10:32:52 AM: ​
10:32:52 AM:   Error message
10:32:52 AM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
10:32:52 AM: ​
10:32:52 AM:   Error location
10:32:52 AM:   In Build command from Netlify app:
10:32:52 AM:   npm run build
10:32:52 AM: ​
10:32:52 AM:   Resolved config
10:32:52 AM:   build:
10:32:52 AM:     command: npm run build
10:32:52 AM:     commandOrigin: ui
10:32:52 AM:     environment:
10:32:52 AM:       - NUXT_PUBLIC_CTF_ACCESS_TOKEN
10:32:52 AM:       - NUXT_PUBLIC_CTF_HOST
10:32:52 AM:       - NUXT_PUBLIC_CTF_PREVIEW_ACCESS_TOKEN
10:32:52 AM:       - NUXT_PUBLIC_CTF_PREVIEW_HOST
10:32:52 AM:       - NUXT_PUBLIC_CTF_SPACE_ID
10:32:52 AM:     publish: /opt/build/repo/dist
10:32:52 AM:     publishOrigin: ui
10:32:52 AM: Caching artifacts
10:32:52 AM: Started saving node modules
10:32:52 AM: Finished saving node modules
10:32:52 AM: Started saving build plugins
10:32:52 AM: Finished saving build plugins
10:32:52 AM: Started saving pip cache
10:32:52 AM: Finished saving pip cache
10:32:52 AM: Started saving emacs cask dependencies
10:32:52 AM: Finished saving emacs cask dependencies
10:32:52 AM: Started saving maven dependencies
10:32:52 AM: Finished saving maven dependencies
10:32:52 AM: Started saving boot dependencies
10:32:52 AM: Finished saving boot dependencies
10:32:52 AM: Started saving rust rustup cache
10:32:52 AM: Finished saving rust rustup cache
10:32:52 AM: Started saving go dependencies
10:32:52 AM: Finished saving go dependencies
10:32:54 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:32:54 AM: Creating deploy upload records
10:32:54 AM: Failing build: Failed to build site
10:32:54 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
10:32:54 AM: Finished processing build request in 1m2.364627244s

hi there, could you share a screenshot of your build settings, please?

Hi @perry, if it were mine you wanted, here they are:
Screenshot from 2022-05-13 08-28-01

No netlify.toml

Pretty slimmed nuxt config:

import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
  runtimeConfig: {
    // The private keys which are only available within server-side
    // Keys within public, will be also exposed to the client-side
    public: {
      ctfSpaceId: '',
      ctfAccessToken: '',
      ctfHost: '',
      ctfPreviewAccessToken: '',
      ctfPreviewHost: '',
    }
  },

  telemetry: true,

  buildModules: [
    '@pinia/nuxt', // state
    '@nuxtjs/tailwindcss', // css
  ],
})

But i’ve tried lots of stuff so this is just the last attempt

I’ve abandoned this repo though and gone back to nuxt 2 for this project, for this and other reasons, it doesn’t seem like Nuxt 3 is quite ready for prime time.

We can troubleshoot it if you want to understand the problem.

Other people in the thread might have more pressing issues :smile_cat:

1 Like

This still sits unresolved - getting the same problem when trying to deploy my Nuxt 3 app RC4.

Do you have a site we can check?

I think it was one of these two things:

  1. I added the dist directory to the gitignore
  2. I had to switch the build command from “npm build” to “npm run build”

Man, I’m switching to another provider. My site was fine, never updated to Nuxt 3, and I still can’t update my site when I revise and continue building. The worst part is I started from scratch thinking that I did something wrong. This is messed up!

Hi @CalypsoDevelopment

Welcome to the community!

Builds fail, with an exit code 1 for a myriad of reasons so we’d need to investigate your particular situation. We understand you’re considering switching to another provider but we’re happy to help you troubleshoot. Could you provide the name of one of the sites experiencing the issue. Perhaps a link to a failed deploy?

Thanks,

Elden