I am deploying my Angular application and getting this error:
sh: 1: ./heroku.build.sh: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] heroku-postbuild: `./heroku.build.sh
package.json
"heroku-postbuild": "./heroku.build.sh"
heroku.build.sh
#!/usr/bin/env bash
usage() {
echo "OVERVIEW: Build apps according to BUILD_ENV value. Meant to be used for Heroku deployment"
exit
}
if [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
usage
fi
(
if [ "$BUILD_ENV" ]; then
ng build $BUILD_ENV --configuration $ENVIRONMENT && ng run $BUILD_ENV:server:$ENVIRONMENT
else
echo "Error: no build config for BUILD_ENV value '$BUILD_ENV'"
exit 1
fi
)
How to fix this error?
I removed node_modules
and deleted the heroku.build.sh
but still it did not work.
CodePudding user response:
chmod x heroku.build.sh in a right directory will solve this issue.
CodePudding user response:
You'll need to make that file executable locally, first.
If you're on a unixy type system you can do something like this:
chmod x path/to/heroku.build.sh
If you're on a Windows machine you'll need a different approach.
Then, commit that change and then redeploy.