I have this error when deploying, please help. https://today-i-learned-23.netlify.app

Deploy log

8:51:03 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)

8:51:03 PM: build-image tag: v4.16.1

8:51:03 PM: buildbot version: a1ec8307ac4591dcd155485cdfce7d7be735ab26

8:51:03 PM: Fetching cached dependencies

8:51:03 PM: Failed to fetch cache, continuing with build

8:51:03 PM: Starting to prepare the repo for build

8:51:03 PM: No cached dependencies found. Cloning fresh repo

8:51:03 PM: git clone --filter=blob:none GitHub - drickpdr98/today-i-learned: full-stack-web-app

8:51:04 PM: Preparing Git Reference refs/heads/master

8:51:05 PM: Parsing package.json dependencies

8:51:06 PM: Starting build script

8:51:06 PM: Installing dependencies

8:51:06 PM: Python version set to 2.7

8:51:06 PM: v16.19.0 is already installed.

8:51:07 PM: Now using node v16.19.0 (npm v8.19.3)

8:51:07 PM: Enabling node corepack

8:51:07 PM: Started restoring cached build plugins

8:51:07 PM: Finished restoring cached build plugins

8:51:07 PM: Attempting ruby version 2.7.2, read from environment

8:51:08 PM: Using ruby version 2.7.2

8:51:08 PM: Using PHP version 8.0

8:51:08 PM: Started restoring cached go cache

8:51:08 PM: Finished restoring cached go cache

8:51:09 PM: go version go1.19.4 linux/amd64

8:51:09 PM: Detected 0 framework(s)

8:51:09 PM: Installing missing commands

8:51:09 PM: Verify run directory

8:51:09 PM: Section completed: initializing

8:51:11 PM: ​

8:51:11 PM: Netlify Build

8:51:11 PM: ────────────────────────────────────────────────────────────────

8:51:11 PM: ​

8:51:11 PM: ❯ Version

8:51:11 PM: @netlify/build 29.4.0

8:51:11 PM: ​

8:51:11 PM: ❯ Flags

8:51:11 PM: baseRelDir: true

8:51:11 PM: buildId: 63b77068d4885444e28a7f25

8:51:11 PM: deployId: 63b77068d4885444e28a7f27

8:51:11 PM: ​

8:51:11 PM: ❯ Current directory

8:51:11 PM: /opt/build/repo

8:51:11 PM: ​

8:51:11 PM: ❯ Config file

8:51:11 PM: No config file was defined: using default values.

8:51:11 PM: ​

8:51:11 PM: ❯ Context

8:51:11 PM: production

8:51:11 PM: ​

8:51:11 PM: 1. Build command from Netlify app

8:51:11 PM: ────────────────────────────────────────────────────────────────

8:51:11 PM: ​

8:51:11 PM: $ npm run build

8:51:11 PM: npm ERR! code ENOENT

8:51:11 PM: npm ERR! syscall open

8:51:11 PM: npm ERR! path /opt/build/repo/package.json

8:51:11 PM: npm ERR! errno -2

8:51:11 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’

8:51:11 PM: npm ERR! enoent This is related to npm not being able to find a file.

8:51:11 PM: npm ERR! enoent

8:51:11 PM: npm ERR! A complete log of this run can be found in:

8:51:11 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-01-06T00_51_11_511Z-debug-0.log

8:51:11 PM: ​

8:51:11 PM: “build.command” failed

8:51:11 PM: ────────────────────────────────────────────────────────────────

8:51:11 PM: ​

8:51:11 PM: Error message

8:51:11 PM: Command failed with exit code 254: npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)

8:51:11 PM: ​

8:51:11 PM: Error location

8:51:11 PM: In Build command from Netlify app:

8:51:11 PM: npm run build

8:51:11 PM: ​

8:51:11 PM: Resolved config

8:51:12 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)

8:51:11 PM: build:

8:51:11 PM: command: npm run build

8:51:11 PM: commandOrigin: ui

8:51:11 PM: environment:

8:51:11 PM: - CI

8:51:11 PM: publish: /opt/build/repo/master

8:51:11 PM: publishOrigin: ui

8:51:11 PM: Caching artifacts

8:51:11 PM: Started saving build plugins

8:51:11 PM: Finished saving build plugins

8:51:11 PM: Started saving pip cache

8:51:11 PM: Finished saving pip cache

8:51:11 PM: Started saving emacs cask dependencies

8:51:11 PM: Finished saving emacs cask dependencies

8:51:11 PM: Started saving maven dependencies

8:51:12 PM: Finished saving maven dependencies

8:51:12 PM: Started saving boot dependencies

8:51:12 PM: Finished saving boot dependencies

8:51:12 PM: Started saving rust rustup cache

8:51:12 PM: Finished saving rust rustup cache

8:51:12 PM: Started saving go dependencies

8:51:12 PM: Finished saving go dependencies

8:51:12 PM: Build failed due to a user error: Build script returned non-zero exit code: 2

8:51:12 PM: Failing build: Failed to build site

8:51:13 PM: Finished processing build request in 9.96631098s

Hi, :wave:t6:

Thanks so much 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.

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!

^ You are executing npm run build

^ npm cannot locate your package.json file

Ensure that you have a package.json file and that it contains a build script.