Skip to content

Netlify deploy error due to permission issue with react-scripts#1

Open
netlify-coding[bot] wants to merge 1 commit into
mainfrom
agent-with-react-scripts-3dce
Open

Netlify deploy error due to permission issue with react-scripts#1
netlify-coding[bot] wants to merge 1 commit into
mainfrom
agent-with-react-scripts-3dce

Conversation

@netlify-coding
Copy link
Copy Markdown

🔗 View agent run: https://app.netlify.com/projects/candid-torte-7f7dca/agent-runs/6a155bac9bd7dd33a8a53dce

🤖 Agent: Claude

💬 Prompt: The Netlify deploy errored, with the following guidance provided:

  • Relevant error lines
    • line 57 – build command running: npm run build
    • line 59 – script invoked: react-scripts build
    • line 60 – actual failure: `...

Result: # Fix Netlify Build Failure: react-scripts Permission Denied

The Netlify deployment was failing with sh: 1: react-scripts: Permission denied (exit code 127) during the npm run build step. A previous fix had already moved react-scripts into dependencies and added a postinstall script to chmod +x the binary, but the permission error persisted across deploys — indicating that the chmod approach was not reliably taking effect in Netlify's build environment before the build command ran.

The root cause is that Netlify's build runner executes the shell-resolved binary at node_modules/.bin/react-scripts, which requires the execute bit to be set on that symlink/file. When that bit is absent (a known issue on some CI/CD Linux environments), the invocation fails regardless of postinstall scripts.

The fix changes the build script in frontend/package.json to invoke react-scripts through node directly:

"build": "node ./node_modules/react-scripts/bin/react-scripts.js build"

Rather than relying on the shell to resolve and execute the binary, the build now calls node (which is always available and executable) and passes the react-scripts entry point as a plain JavaScript file. This completely bypasses the execute-bit requirement and is unaffected by file permission states on the build host. The postinstall chmod script was retained as a harmless safeguard for other tooling that may invoke the binary directly.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 26, 2026

Deploy Preview for candid-torte-7f7dca ready!

Name Link
🔨 Latest commit 4c3a349
🔍 Latest deploy log https://app.netlify.com/projects/candid-torte-7f7dca/deploys/6a155d180b9bf40008de7c34
😎 Deploy Preview https://deploy-preview-1--candid-torte-7f7dca.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants