I have a project that is supposed to be on automatic deployments when I push changes to it from the repository on github but keep getting the following error message:
2:57:37 PM: 1. Build command from Netlify app
2:57:37 PM: ────────────────────────────────────────────────────────────────
2:57:37 PM:
2:57:37 PM: $ CI= npm run build
2:57:37 PM: npm ERR! code ENOENT
2:57:37 PM: npm ERR! syscall open
2:57:37 PM: npm ERR! path /opt/build/repo/package.json
2:57:37 PM: npm ERR! errno -2
2:57:37 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
2:57:37 PM: npm ERR! enoent This is related to npm not being able to find a file.
2:57:37 PM: npm ERR! enoent
2:57:37 PM: npm ERR! A complete log of this run can be found in:
2:57:37 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-11-28T22_57_37_886Z-debug.log
2:57:37 PM:
2:57:37 PM: ────────────────────────────────────────────────────────────────
2:57:37 PM: “build.command” failed
2:57:37 PM: ────────────────────────────────────────────────────────────────
2:57:37 PM:
2:57:37 PM: Error message
2:57:37 PM: Command failed with exit code 254: CI= npm run build
2:57:37 PM:
2:57:37 PM: Error location
2:57:37 PM: In Build command from Netlify app:
2:57:37 PM: CI= npm run build
2:57:37 PM:
2:57:37 PM: Resolved config
2:57:37 PM: build:
2:57:37 PM: command: CI= npm run build
2:57:37 PM: commandOrigin: ui
2:57:37 PM: publish: /opt/build/repo/build
2:57:38 PM: Caching artifacts
2:57:38 PM: Started saving build plugins
2:57:38 PM: Finished saving build plugins
2:57:38 PM: Started saving pip cache
2:57:38 PM: Finished saving pip cache
2:57:38 PM: Started saving emacs cask dependencies
2:57:38 PM: Finished saving emacs cask dependencies
2:57:38 PM: Started saving maven dependencies
2:57:38 PM: Finished saving maven dependencies
2:57:38 PM: Started saving boot dependencies
2:57:38 PM: Finished saving boot dependencies
2:57:38 PM: Started saving go dependencies
2:57:38 PM: Finished saving go dependencies
2:57:40 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:57:40 PM: Failing build: Failed to build site
2:57:40 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
I noticed this error has happened even after I was able to successfully deploy it with automatic deployments initially.