The Netlify deploy errored. The relevant error log line information is:
Line 27: No npm workspaces detected
Line 28: Started restoring cached node modules
Line 29: Finished restoring cached node modules
Line 30: Installing npm packages using npm version 10.9.2
Line 31: added 5 packages in 1s
Line 32: npm packages installed
Line 33: Successfully installed dependencies
Line 34: Starting build script
Line 35: Detected 0 framework(s)
Line 36: Section completed: initializing
Line 37: Failed during stage 'building site': Build script returned non-zero exit code: 2
Line 38: [96m[1m[22m[39m
Line 39: [96m[1mNetlify Build [22m[39m
Line 40: [96m[1m────────────────────────────────────────────────────────────────[22m[39m
Line 41: [36m[1m[22m[39m
Line 42: [36m[1m❯ Version[22m[39m
Line 43: @netlify/build 33.1.3
Line 44: [36m[1m[22m[39m
Line 45: [36m[1m❯ Flags[22m[39m
Line 46: accountId: 682e2fa484f540dc0046496c
Line 47: baseRelDir: true
Line 54: [36m[1m❯ Config file[22m[39m
Line 55: No config file was defined: using default values.
Line 56: [36m[1m[22m[39m
Line 57: [36m[1m❯ Context[22m[39m
Line 58: production
Line 59: [96m[1m[22m[39m
Line 60: [96m[1mBuild command from Netlify app [22m[39m
Line 61: [96m[1m────────────────────────────────────────────────────────────────[22m[39m
Line 62:
Line 63: [36m$ npm run build[39m
Line 64: npm error Missing script: "build"
Line 65: npm error
Line 66: npm error To see a list of scripts, run:
Line 67: npm error npm run
Line 68: npm error A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2025-05-22T02_52_39_227Z-debug-0.log
Line 69: [91m[1m[22m[39m
Line 70: [91m[1m"build.command" failed [22m[39m
Line 71: [91m[1m────────────────────────────────────────────────────────────────[22m[39m
Line 72:
Line 73: [31m[1mError message[22m[39m
Line 74: Command failed with exit code 1: npm run build
Line 75:
Line 76: [31m[1mError location[22m[39m
Line 77: In Build command from Netlify app:
Line 78: npm run build
Line 79:
Line 80: [31m[1mResolved config[22m[39m
Line 81: build:
Line 82: command: npm run build
Line 83: commandOrigin: ui
Line 84: publish: /opt/build/repo/build
Line 85: publishOrigin: ui
Line 86: Build failed due to a user error: Build script returned non-zero exit code: 2
Line 87: Failing build: Failed to build site
Line 88: Finished processing build request in 12.555s
Netlify has analyzed the error and provided the following guidance:
**Diagnosis:**
The build failed with the following error:
- Line 63: `npm error Missing script: "build"`
- Line 73: `Command failed with exit code 1: npm run build`
**Solution:**
1. Verify that the `build` script is defined in the `package.json` file in the repository.
2. If the script is missing, add the `build` script to the `scripts` section of the `package.json` file:
```json
"scripts": {
"build": "your-build-command-here"
}
```
3. After adding the script, ensure you commit the changes to the repository and trigger a new build.