Netlify Deploy issue code 127

site link - https://react-chat-page.netlify.app/
github - https://github.com/mrshawnhum/chat-app

I have recently added a redirect file to fix a bug when you refresh the site and I added automatic deploys with netlify-cli to my project. The first time I added Yarn Run Build and received a exit code 127 when attempting to deploy. I manually changed it on netlify to Yarn Build and still receive the same message. I also attempted to clear the cache and manually deploy the site and still receive same message.

hi there, this is a fairly common error - here are some threads from people who have already solved it:

I also recommend you run a search on “127” as there are many other posts relating to this, and, also, here is a lot of general debugging info to help you out.

This Support Guide contains a ton of useful debugging tips.

Hello,

Thank you for the reply! I have been through that thread and probably 2 pages of Google trying to fix my issue and can’t seem to find the solution. One thing I can point out is I have a package.json and yarn.lock and wonder if that might cause an issue.

can you try removing the package.json and just using the yarn.lock and see if that fixes things?

Doesn’t seem to fix the issue. Here is full log below

1:46:23 PM: Build ready to start
1:46:25 PM: build-image version: ca811f47d4c1cbd1812d1eb6ecb0c977e86d1a1d
1:46:25 PM: build-image tag: v3.3.20
1:46:25 PM: buildbot version: be8ecf2af866e16fa4301cc5c14de2ccbbb21cf4
1:46:25 PM: Fetching cached dependencies
1:46:25 PM: Starting to download cache of 254.8KB
1:46:25 PM: Finished downloading cache in 95.335317ms
1:46:25 PM: Starting to extract cache
1:46:25 PM: Failed to fetch cache, continuing with build
1:46:25 PM: Starting to prepare the repo for build
1:46:26 PM: No cached dependencies found. Cloning fresh repo
1:46:26 PM: git clone git@github.com:mrshawnhum/chat-app
1:46:27 PM: Preparing Git Reference refs/heads/master
1:46:28 PM: Starting build script
1:46:28 PM: Installing dependencies
1:46:28 PM: Python version set to 2.7
1:46:29 PM: v12.18.0 is already installed.
1:46:30 PM: Now using node v12.18.0 (npm v6.14.4)
1:46:30 PM: Started restoring cached build plugins
1:46:30 PM: Finished restoring cached build plugins
1:46:30 PM: Attempting ruby version 2.7.1, read from environment
1:46:32 PM: Using ruby version 2.7.1
1:46:32 PM: Using PHP version 5.6
1:46:32 PM: 5.2 is already installed.
1:46:32 PM: Using Swift version 5.2
1:46:32 PM: Started restoring cached go cache
1:46:32 PM: Finished restoring cached go cache
1:46:32 PM: go version go1.14.4 linux/amd64
1:46:32 PM: go version go1.14.4 linux/amd64
1:46:32 PM: Installing missing commands
1:46:32 PM: Verify run directory
1:46:33 PM: ​
1:46:33 PM: ┌─────────────────────────────┐
1:46:33 PM: │ Netlify Build │
1:46:33 PM: └─────────────────────────────┘
1:46:33 PM: ​
1:46:33 PM: ❯ Version
1:46:33 PM: @netlify/build 3.0.1
1:46:33 PM: ​
1:46:33 PM: ❯ Flags
1:46:33 PM: deployId: 5f1b2c7f33a8f557a9fc5981
1:46:33 PM: mode: buildbot
1:46:33 PM: ​
1:46:33 PM: ❯ Current directory
1:46:33 PM: /opt/build/repo
1:46:33 PM: ​
1:46:33 PM: ❯ Config file
1:46:33 PM: No config file was defined: using default values.
1:46:33 PM: ​
1:46:33 PM: ❯ Context
1:46:33 PM: production
1:46:33 PM: ​
1:46:33 PM: ┌───────────────────────────────────┐
1:46:33 PM: │ 1. Build command from Netlify app │
1:46:33 PM: └───────────────────────────────────┘
1:46:33 PM: ​
1:46:33 PM: $ yarn build
1:46:33 PM: bash: yarn: command not found
1:46:33 PM: ​
1:46:33 PM: ┌─────────────────────────────┐
1:46:33 PM: │ “build.command” failed │
1:46:33 PM: └─────────────────────────────┘
1:46:33 PM: ​
1:46:33 PM: Error message
1:46:33 PM: Command failed with exit code 127: yarn build
1:46:33 PM: ​
1:46:33 PM: Error location
1:46:33 PM: In Build command from Netlify app:
1:46:33 PM: yarn build
1:46:33 PM: ​
1:46:33 PM: Resolved config
1:46:33 PM: build:
1:46:33 PM: command: yarn build
1:46:33 PM: commandOrigin: ui
1:46:33 PM: publish: /opt/build/repo/build
1:46:34 PM: Caching artifacts
1:46:34 PM: Started saving build plugins
1:46:34 PM: Finished saving build plugins
1:46:34 PM: Started saving pip cache
1:46:34 PM: Finished saving pip cache
1:46:34 PM: Started saving emacs cask dependencies
1:46:34 PM: Finished saving emacs cask dependencies
1:46:34 PM: Started saving maven dependencies
1:46:34 PM: Finished saving maven dependencies
1:46:34 PM: Started saving boot dependencies
1:46:34 PM: Finished saving boot dependencies
1:46:34 PM: Started saving go dependencies
1:46:34 PM: Finished saving go dependencies
1:46:36 PM: Error running command: Build script returned non-zero exit code: 1
1:46:36 PM: Failing build: Failed to build site
1:46:36 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
1:46:37 PM: Finished processing build request in 11.633318762s

It still shows failed build, but i made a new deployment and it worked

Hi, @mrshawnhum, exit code 127 means “command not found”. Yarn isn’t found because out build system didn’t see a yarn.lock in the base of the repo (because there isn’t one).

So when yarn build is run it fails because no yarn is installed. To have us install yarn, you need a yarn.lock file in the base of the build directory, whatever directory that is.

The most recent deploy was successful but there was also no build. It was a manual deploy.

If there are other questions about this, please let us know.