Ionic Appflow - package.json and shell scripts


In the Build Environments docs for Appflow ( there is an example that uses a custom shell script to read the branch and triggers a custom build:


"scripts": {
    "build": "./",

if [ "$CI_GIT_REF" = "master" ]; then
    npx ionic build --prod
    npx ionic build

I am trying this exact code and seem to get a permission error when attempting to package the build. Wondering what deal is or if I am doing something wrong. Thanks.

> ./

sh: ./ Permission denied
npm ERR! errno 126
npm ERR! vipcrowd@1.0.0 build: `./`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the vipcrowd@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ionic/.npm/_logs/2019-01-04T22_29_55_359Z-debug.log

EDIT: My end goal is to use different build scripts based on the env and eventually have different cordova plugin variables based on env. So either a fix to this or alternate method would help greatly.

1 Like

I am seeing the exact same thing. Does anyone have any ideas?


How and where did you create that file? On Linux/macOS and set it to executable? Or on Windows where this doesn’t matter?

Also, did you see this note on that documentation page?

Note: This feature is only available on our Growth plans and above.


So, for an update, I stopped trying to use this implementation because I could not get it to work. Instead I was able to change the way we used certain plugins to not be so heavily reliable on the build script. That being said, at this time and at the time of the original post we were paying for our Growth plan. I was also operating on macOS Mojave. As far as setting it to executable I am not positive but I am pretty sure it was running locally just fine

1 Like

Windows 10 for me. I placed it at the same level as package.json.
I have a growth plan


Answer hopefully is here.

Worked for me.