aws-amplify / aws-amplify/amplify-cli

Getting an error 127 when building an application in amplify deoployment

Open
#14,247 1 comment 0 reactions 0 assignees View on GitHub
pending-response question
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

### If applicable, what version of Node.js are you using?

v20.15.0

### Amplify CLI Version

14.0.0

### What operating system are you using?

mac

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

Here is the build settings.yaml

version: 1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- echo "Listing files in root:"
- ls -al
- echo "Printing contents of pom.xml:"
- cat package.json || echo "package.json not found"
#- rm -rf .npm # Clear npm cache to ensure fresh dependencies
#- npm ci --cache .npm --prefer-offline
build:
commands:
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
#cache:
# paths:
# - .npm/**/*

### Describe the bug

I have connected my amplify deployment with github directory
i commit the code the deployment starts
build fails

> react-scripts build

2025-08-02T13:26:10.713Z [WARNING]: sh: line 1: react-scripts: command not found
2025-08-02T13:26:10.721Z [ERROR]: !!! Build failed
2025-08-02T13:26:10.722Z [ERROR]: !!! Error: Command failed with exit code 127

I printed the package.json content during preBuild

{
"name": "amplify-login",
"version": "0.1.0",
"private": true,
"dependencies": {
"@aws-amplify/cli": "^14.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"aws-amplify": "^6.15.4",
"axios": "^1.11.0",
"moment": "^2.29.4",
"nanoid": "^5.1.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-modal": "^3.16.1",
"react-phone-number-input": "^3.2.12",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-select": "^5.6.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
}
}

### Expected behavior

I have run this app in another aws account before

### Reproduction steps

all deployments

### Project Identifier

project identifier
447ae9bf7c54c3c370919fb00a5fb15a

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

### Before submitting, please confirm:

- [x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [x] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Research direction

Start with build settings.yaml and package.json, then inspect the Amplify deployment phases before npm run build. Reproduce the deployment and check whether dependencies are installed before the build command; done means react-scripts is available and the configured npm run build completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, nodejs, react
Domain
build-system, cli, cloud, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.