Netlify deploy error due to permission issue with react-scripts#1
Open
netlify-coding[bot] wants to merge 1 commit into
Open
Netlify deploy error due to permission issue with react-scripts#1netlify-coding[bot] wants to merge 1 commit into
netlify-coding[bot] wants to merge 1 commit into
Conversation
…5bac9bd7dd33a8a53dce)
✅ Deploy Preview for candid-torte-7f7dca ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 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:
npm run buildreact-scripts build✅ 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 thenpm run buildstep. A previous fix had already movedreact-scriptsintodependenciesand added apostinstallscript tochmod +xthe 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
buildscript infrontend/package.jsonto invokereact-scriptsthroughnodedirectly: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 thereact-scriptsentry point as a plain JavaScript file. This completely bypasses the execute-bit requirement and is unaffected by file permission states on the build host. Thepostinstallchmod script was retained as a harmless safeguard for other tooling that may invoke the binary directly.