Having issues deploying Next.js

Hello, I’m having issues deploying my next.js app and I’m receiving a 254 error. The complete error is pasted below. I’ve tried many suggestions that I’ve found here on the support forums but I’m still running into issues. Hoping someone can advise. Thanks so much!!

9:14:55 PM: build-image version: a2d22d22e4555d1ef0a972ed14a0a4b366ad20c4 (focal)
9:14:55 PM: build-image tag: v4.16.3
9:14:55 PM: buildbot version: 9a6b4d0d37eb2a90e2c482e1d6cfe9a0793e6262
9:14:55 PM: Building without cache
9:14:55 PM: Starting to prepare the repo for build
9:14:56 PM: No cached dependencies found. Cloning fresh repo
9:14:56 PM: git clone --filter=blob:none GitHub - justinharris23/portfolio2
9:15:03 PM: Preparing Git Reference refs/heads/main
9:15:04 PM: Parsing package.json dependencies
9:15:05 PM: Starting build script
9:15:05 PM: Installing dependencies
9:15:05 PM: Python version set to 2.7
9:15:05 PM: v16.19.0 is already installed.
9:15:06 PM: Now using node v16.19.0 (npm v8.19.3)
9:15:06 PM: Enabling Node.js Corepack
9:15:06 PM: Started restoring cached build plugins
9:15:06 PM: Finished restoring cached build plugins
9:15:06 PM: Attempting Ruby version 2.7.2, read from environment
9:15:06 PM: Using Ruby version 2.7.2
9:15:07 PM: Using PHP version 8.0
9:15:07 PM: Started restoring cached go cache
9:15:07 PM: Finished restoring cached go cache
9:15:07 PM: go version go1.19.4 linux/amd64
9:15:07 PM: Detected 0 framework(s)
9:15:07 PM: Installing missing commands
9:15:07 PM: Verify run directory
9:15:07 PM: Section completed: initializing
9:15:08 PM: ​
9:15:08 PM: Netlify Build
9:15:08 PM: ────────────────────────────────────────────────────────────────
9:15:08 PM: ​
9:15:08 PM: ❯ Version
9:15:08 PM: @netlify/build 29.4.1
9:15:08 PM: ​
9:15:08 PM: ❯ Flags
9:15:08 PM: baseRelDir: true
9:15:08 PM: buildId: 63bf6d1d9fec126e25449d81
9:15:08 PM: deployId: 63bf6d1d9fec126e25449d83
9:15:08 PM: ​
9:15:08 PM: ❯ Current directory
9:15:08 PM: /opt/build/repo
9:15:08 PM: ​
9:15:08 PM: ❯ Config file
9:15:08 PM: No config file was defined: using default values.
9:15:08 PM: ​
9:15:08 PM: ❯ Context
9:15:08 PM: production
9:15:08 PM: ​
9:15:08 PM: 1. Build command from Netlify app
9:15:08 PM: ────────────────────────────────────────────────────────────────
9:15:08 PM: ​
9:15:08 PM: $ npm run build
9:15:08 PM: npm ERR! code ENOENT
9:15:08 PM: npm ERR! syscall open
9:15:08 PM: npm ERR! path /opt/build/repo/package.json
9:15:08 PM: npm ERR! errno -2
9:15:08 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
9:15:08 PM: npm ERR! enoent This is related to npm not being able to find a file.
9:15:08 PM: npm ERR! enoent
9:15:08 PM: npm ERR! A complete log of this run can be found in:
9:15:08 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-01-12T02_15_08_875Z-debug-0.log
9:15:09 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)
9:15:08 PM: ​
9:15:08 PM: “build.command” failed
9:15:08 PM: ────────────────────────────────────────────────────────────────
9:15:08 PM: ​
9:15:08 PM: Error message
9:15:08 PM: Command failed with exit code 254: npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
9:15:08 PM: ​
9:15:08 PM: Error location
9:15:08 PM: In Build command from Netlify app:
9:15:08 PM: npm run build
9:15:08 PM: ​
9:15:08 PM: Resolved config
9:15:08 PM: build:
9:15:08 PM: command: npm run build
9:15:08 PM: commandOrigin: ui
9:15:08 PM: publish: /opt/build/repo
9:15:08 PM: publishOrigin: default
9:15:09 PM: Caching artifacts
9:15:09 PM: Started saving build plugins
9:15:09 PM: Finished saving build plugins
9:15:09 PM: Started saving pip cache
9:15:09 PM: Finished saving pip cache
9:15:09 PM: Started saving emacs cask dependencies
9:15:09 PM: Finished saving emacs cask dependencies
9:15:09 PM: Started saving maven dependencies
9:15:09 PM: Finished saving maven dependencies
9:15:09 PM: Started saving boot dependencies
9:15:09 PM: Finished saving boot dependencies
9:15:09 PM: Started saving rust rustup cache
9:15:09 PM: Finished saving rust rustup cache
9:15:09 PM: Started saving go dependencies
9:15:09 PM: Finished saving go dependencies
9:15:09 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:15:09 PM: Failing build: Failed to build site
9:15:10 PM: Finished processing build request in 14.321313117s

I made a few changes to my build settings and now I"m seeing this error instead. Any help would be greatly appreciated. Thank you!!

8:09:48 AM: Failed to compile.
8:09:48 AM: ./pages/index.tsx
8:09:48 AM: 38:17 Error: Using target=“_blank” without rel=“noreferrer” (which implies rel=“noopener”) is a security risk in older browsers: see About rel=noopener react/jsx-no-target-blank
8:09:48 AM: 64:13 Error: Using target=“_blank” without rel=“noreferrer” (which implies rel=“noopener”) is a security risk in older browsers: see About rel=noopener react/jsx-no-target-blank
8:09:48 AM: 67:13 Error: Using target=“_blank” without rel=“noreferrer” (which implies rel=“noopener”) is a security risk in older browsers: see About rel=noopener react/jsx-no-target-blank
8:09:48 AM: 90:72 Error: ' can be escaped with ', ‘, ', ’. react/no-unescaped-entities
8:09:48 AM: info - Need to disable some ESLint rules? Learn more here: Basic Features: ESLint | Next.js
8:09:48 AM: ​
8:09:48 AM: “build.command” failed
8:09:48 AM: ────────────────────────────────────────────────────────────────
8:09:48 AM: ​
8:09:48 AM: Error message
8:09:48 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
8:09:48 AM: ​
8:09:48 AM: Error location
8:09:48 AM: In build.command from netlify.toml:
8:09:48 AM: npm run build
8:09:48 AM: ​
8:09:48 AM: Resolved config
8:09:48 AM: build:
8:09:48 AM: base: /opt/build/repo/jh-portfolio
8:09:48 AM: command: npm run build
8:09:48 AM: commandOrigin: config
8:09:48 AM: publish: /opt/build/repo/jh-portfolio/jh-portfolio
8:09:48 AM: publishOrigin: config
8:09:48 AM: functionsDirectory: /opt/build/repo/jh-portfolio/functions
8:09:48 AM: Caching artifacts
8:09:48 AM: Started saving node modules
8:09:48 AM: Finished saving node modules
8:09:48 AM: Started saving build plugins
8:09:49 AM: Finished saving build plugins
8:09:49 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:09:49 AM: Started saving pip cache
8:09:49 AM: Finished saving pip cache
8:09:49 AM: Started saving emacs cask dependencies
8:09:49 AM: Finished saving emacs cask dependencies
8:09:49 AM: Started saving maven dependencies
8:09:49 AM: Finished saving maven dependencies
8:09:49 AM: Started saving boot dependencies
8:09:49 AM: Finished saving boot dependencies
8:09:49 AM: Started saving rust rustup cache
8:09:49 AM: Finished saving rust rustup cache
8:09:49 AM: Started saving go dependencies
8:09:49 AM: Finished saving go dependencies
8:09:49 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:09:49 AM: Failing build: Failed to build site
8:09:49 AM: Finished processing build request in 25.223179512s

Hi @skyehunter :wave:t6:,

Thanks for reaching out and welcome to the Netlify Forums. First, have you looked through this resource 7? It is a compilation of all of our build and deploy resources. This is a good starting point.

If those resources don’t get you on the right track, can you share a bit more information about what you are trying to accomplish?

Lastly, please share these additional details so we can look into your experience further:

  • the name of your build instance: “example-jones.netlify.com 1
  • your project repo
  • what you have already tried
  • any error messages you have received in your terminal window or in the developer console

Thanks so much!