Sanity: not found error

Hello all - there’s a lot of info about this 127 error code, but nothing on the sanity: not found error which seems to be the issue. I think the solution is very simple, but nothing I’ve tried works. I’ve cleared the cache, reset the build, deleted the lock files (both yarn and json) and rebuilt them, I disconnected the GitHub (because I had to delete the original and reset the git files) and reconnected it, I’ve tried using yarn build instead of npm run build. None of these have worked. Can someone help me see what I’m missing?

────────────────────────────────────────────────────────────────

4:54:43 AM: Netlify Build

4:54:43 AM: ────────────────────────────────────────────────────────────────

4:54:43 AM: ​

4:54:43 AM: ❯ Version

4:54:43 AM: @netlify/build 27.18.4

4:54:43 AM: ​

4:54:43 AM: ❯ Flags

4:54:43 AM: baseRelDir: true

4:54:43 AM: buildId: 632aed41cf1f660daf562789

4:54:43 AM: deployId: 632aed41cf1f660daf56278b

4:54:43 AM: ​

4:54:43 AM: ❯ Current directory

4:54:43 AM: /opt/build/repo

4:54:43 AM: ​

4:54:43 AM: ❯ Config file

4:54:43 AM: /opt/build/repo/netlify.toml

4:54:43 AM: ​

4:54:43 AM: ❯ Context

4:54:43 AM: production

4:54:43 AM: ​

4:54:43 AM: ────────────────────────────────────────────────────────────────

4:54:43 AM: 1. build.command from netlify.toml

4:54:43 AM: ────────────────────────────────────────────────────────────────

4:54:43 AM: ​

4:54:43 AM: $ npm run build

4:54:43 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

4:54:43 AM: npm WARN config location in the cache, and they are managed by

4:54:43 AM: npm WARN config cacache.

4:54:43 AM: > joseph-center@1.0.0 build

4:54:43 AM: > sanity build

4:54:44 AM: /tmp/build-7bd31b26.sh: 1: sanity: not found

4:54:44 AM: ​

4:54:44 AM: ────────────────────────────────────────────────────────────────

4:54:44 AM: “build.command” failed

4:54:44 AM: ────────────────────────────────────────────────────────────────

4:54:44 AM: ​

4:54:44 AM: Error message

4:54:44 AM: Command failed with exit code 127: npm run build (Search results for '"non-zero exit code: 127"' - Netlify Support Forums)

4:54:44 AM: ​

4:54:44 AM: Error location

4:54:44 AM: In build.command from netlify.toml:

4:54:44 AM: npm run build

4:54:44 AM: ​

4:54:44 AM: Resolved config

4:54:44 AM: build:

4:54:44 AM: command: npm run build

4:54:44 AM: commandOrigin: config

4:54:44 AM: publish: /opt/build/repo/dist

4:54:44 AM: publishOrigin: ui

4:54:44 AM: redirects:

4:54:44 AM: - from: /*
status: 200
to: /index.html
redirectsOrigin: config
Caching artifacts

4:54:44 AM: Started saving node modules

4:54:44 AM: Finished saving node modules

4:54:44 AM: Started saving build plugins

4:54:44 AM: Finished saving build plugins

4:54:44 AM: Started saving yarn cache

4:55:01 AM: Finished saving yarn cache

4:55:01 AM: Started saving pip cache

4:55:01 AM: Finished saving pip cache

4:55:01 AM: Started saving emacs cask dependencies

4:55:01 AM: Finished saving emacs cask dependencies

4:55:01 AM: Started saving maven dependencies

4:55:01 AM: Finished saving maven dependencies

4:55:01 AM: Started saving boot dependencies

4:55:01 AM: Finished saving boot dependencies

4:55:01 AM: Started saving rust rustup cache

4:55:01 AM: Finished saving rust rustup cache

4:55:01 AM: Started saving go dependencies

4:55:01 AM: Finished saving go dependencies

4:55:04 AM: Creating deploy upload records

4:55:04 AM: Failing build: Failed to build site

4:55:04 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)

4:55:04 AM: Finished processing build request in 1m9.374614676s

Ok, figured it out. I used npm i @sanity/cli to add this to the package.json file - my other Sanity builds are running without this so I don’t know what the difference is but it did fix the issue here!

Thanks for coming back and sharing your solution! I am glad that you have solved this issue.