Failure to deploy Nuxt application

I am trying to deploy a Nuxt application and I followed a udemy lecture step by step, theres worked, but mine is not, any help would be much appreciated.

Site name: capable-sopapillas-0204c5

Build Log:
7:00:42 PM: Build ready to start
7:00:44 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
7:00:44 PM: build-image tag: v4.8.0
7:00:44 PM: buildbot version: 17f6c1ab2fe6d61574ce02b038041b816bf6c085
7:00:44 PM: Fetching cached dependencies
7:00:44 PM: Starting to download cache of 676.1KB
7:00:44 PM: Finished downloading cache in 154.455861ms
7:00:44 PM: Starting to extract cache
7:00:44 PM: Finished extracting cache in 13.041304ms
7:00:44 PM: Finished fetching cache in 167.765258ms
7:00:44 PM: Starting to prepare the repo for build
7:00:45 PM: Preparing Git Reference refs/heads/master
7:00:45 PM: Parsing package.json dependencies
7:00:46 PM: Starting build script
7:00:46 PM: Installing dependencies
7:00:46 PM: Python version set to 2.7
7:00:46 PM: Downloading and installing node v16.15.0…
7:00:46 PM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz
7:00:47 PM: Computing checksum with sha256sum
7:00:47 PM: Checksums matched!
7:00:49 PM: Now using node v16.15.0 (npm v8.5.5)
7:00:49 PM: Started restoring cached build plugins
7:00:49 PM: Finished restoring cached build plugins
7:00:49 PM: Attempting ruby version 2.7.2, read from environment
7:00:50 PM: Using ruby version 2.7.2
7:00:50 PM: Using PHP version 8.0
7:00:50 PM: Started restoring cached go cache
7:00:50 PM: Finished restoring cached go cache
7:00:50 PM: go version go1.16.5 linux/amd64
7:00:50 PM: go version go1.16.5 linux/amd64
7:00:50 PM: Installing missing commands
7:00:50 PM: Verify run directory
7:00:52 PM: ​
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: Netlify Build
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: ​
7:00:52 PM: ❯ Version
7:00:52 PM: @netlify/build 27.1.3
7:00:52 PM: ​
7:00:52 PM: ❯ Flags
7:00:52 PM: baseRelDir: true
7:00:52 PM: buildId: 628a7a075a97cd0e6a54ecf0
7:00:52 PM: deployId: 628a7a075a97cd0e6a54ecf2
7:00:52 PM: ​
7:00:52 PM: ❯ Current directory
7:00:52 PM: /opt/build/repo
7:00:52 PM: ​
7:00:52 PM: ❯ Config file
7:00:52 PM: No config file was defined: using default values.
7:00:52 PM: ​
7:00:52 PM: ❯ Context
7:00:52 PM: production
7:00:52 PM: ​
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: 1. Build command from Netlify app
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: ​
7:00:52 PM: $ npm run generate
7:00:52 PM: npm ERR! code ENOENT
7:00:52 PM: npm ERR! syscall open
7:00:52 PM: npm ERR! path /opt/build/repo/package.json
7:00:52 PM: npm ERR! errno -2
7:00:52 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
7:00:52 PM: npm ERR! enoent This is related to npm not being able to find a file.
7:00:52 PM: npm ERR! enoent
7:00:52 PM: npm ERR! A complete log of this run can be found in:
7:00:52 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-05-22T18_00_52_303Z-debug-0.log
7:00:52 PM: ​
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: “build.command” failed
7:00:52 PM: ────────────────────────────────────────────────────────────────
7:00:52 PM: ​
7:00:52 PM: Error message
7:00:52 PM: Command failed with exit code 254: npm run generate (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
7:00:52 PM: ​
7:00:52 PM: Error location
7:00:52 PM: In Build command from Netlify app:
7:00:52 PM: npm run generate
7:00:52 PM: ​
7:00:52 PM: Resolved config
7:00:52 PM: build:
7:00:52 PM: command: npm run generate
7:00:52 PM: commandOrigin: ui
7:00:52 PM: publish: /opt/build/repo/dist
7:00:52 PM: publishOrigin: ui
7:00:52 PM: Caching artifacts
7:00:52 PM: Started saving build plugins
7:00:53 PM: Finished saving build plugins
7:00:54 PM: Creating deploy upload records
7:00:53 PM: Started saving pip cache
7:00:53 PM: Finished saving pip cache
7:00:53 PM: Started saving emacs cask dependencies
7:00:53 PM: Finished saving emacs cask dependencies
7:00:53 PM: Started saving maven dependencies
7:00:53 PM: Finished saving maven dependencies
7:00:53 PM: Started saving boot dependencies
7:00:53 PM: Finished saving boot dependencies
7:00:53 PM: Started saving rust rustup cache
7:00:54 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)
7:00:53 PM: Finished saving rust rustup cache
7:00:53 PM: Started saving go dependencies
7:00:53 PM: Finished saving go dependencies
7:00:54 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:00:54 PM: Failing build: Failed to build site
7:00:54 PM: Finished processing build request in 10.392917083s

Hey @ErraticJL

As mentioned by @yemoji in this post the issue is there is no package.json at the root of the repository you are deploying from. This likely means the code you are trying to deploy is in a sub-directory. If this is the case you need to set the base directory value to that of the directory name. Check out this documentation for more.

If this fails, please share the build settings you have used and the repository you are deploying from.

Note too, that your issue is very different from that of the other thread you posted in.