Failed build ionic-app-scripts: Permission denied

Hello.
I successfully pushed to ionic pro server my project. But it occurs a error:

Running with gitlab-ci-multi-runner 9.1.0 (0118d89)
  on Snapshot Builds (c9648220)
Using Shell executor...
Running on ip-10-2-14-100...
Cloning repository...
Cloning into '/home/gitlab-runner/builds/c9648220/0/project-1'...
Checking out 52aa29a1 as master...
Skipping Git submodules setup
$ run "fetch-updates"
Checking for build process updates...
$ run "build-app"
Attempting to restore cached packages...
Package cache restored!
$ npm run build
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
npm info lifecycle RSMobile@~prebuild: RSMobile@
npm info lifecycle RSMobile@~build: RSMobile@

> RSMobile@ build /usr/src/app
> ionic-app-scripts build

sh: 1: ionic-app-scripts: Permission denied
npm info lifecycle RSMobile@~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! RSMobile@ build: `ionic-app-scripts build`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the RSMobile@ 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!     /home/gitlab-runner/.npm/_logs/2017-12-05T16_53_51_610Z-debug.log
npm run build failed
Running after script...
$ run "clean-up"
ERROR: Job failed: exit status 1

What it is can be?
Note: I push it without node_modules folder.

My ionic info is:

ionic info

cli packages:

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.4
    Cordova Platforms  : android 6.2.3 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v6.11.4
    npm               : 4.4.4
    OS                : Windows 8.1

Environment Variables:

    ANDROID_HOME : D:\AndroidSDK2

Misc:

    backend : pro


D:\denwerready\siteapp\appsource>

My ionic pro id is db52ec95
And package.json

{
  "name": "Name of app",
  "author": "R*****t lab.",
  "homepage": "read******",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.4.6",
    "@angular/compiler": "4.4.6",
    "@angular/compiler-cli": "4.4.6",
    "@angular/core": "4.4.6",
    "@angular/forms": "4.4.6",
    "@angular/http": "4.4.6",
    "@angular/platform-browser": "4.4.6",
    "@angular/platform-browser-dynamic": "4.4.6",
    "@ionic-native/app-version": "4.3.2",
    "@ionic-native/call-number": "4.3.2",
    "@ionic-native/core": "4.4.2",
    "@ionic-native/device": "4.3.2",
    "@ionic-native/geolocation": "4.3.2",
    "@ionic-native/google-analytics": "4.3.2",
    "@ionic-native/http": "4.4.2",
    "@ionic-native/in-app-browser": "4.3.2",
    "@ionic-native/native-storage": "4.3.2",
    "@ionic-native/network": "4.3.2",
    "@ionic-native/push": "4.4.2",
    "@ionic-native/screen-orientation": "4.3.2",
    "@ionic-native/splash-screen": "4.3.2",
    "@ionic-native/status-bar": "4.3.2",
    "@ionic/cloud-angular": "0.12.0",
    "@ionic/storage": "2.1.3",
    "call-number": "1.0.1",
    "cordova-android": "~6.2.3",
    "cordova-plugin-advanced-http": "1.9.0",
    "cordova-plugin-app-version": "0.1.9",
    "cordova-plugin-compat": "1.2.0",
    "cordova-plugin-console": "1.1.0",
    "cordova-plugin-device": "1.1.7",
    "cordova-plugin-file": "4.3.3",
    "cordova-plugin-geolocation": "2.4.3",
    "cordova-plugin-google-analytics": "1.8.3",
    "cordova-plugin-inappbrowser": "1.7.2",
    "cordova-plugin-network-information": "1.3.4",
    "cordova-plugin-screen-orientation": "2.0.2",
    "cordova-plugin-splashscreen": "4.1.0",
    "cordova-plugin-statusbar": "2.3.0",
    "cordova-plugin-whitelist": "1.3.2",
    "deep-equal": "1.0.1",
    "es6-promise-plugin": "4.1.1",
    "ionic-angular": "3.9.2",
    "ionic-image-loader": "4.2.1",
    "ionic-plugin-deploy": "0.6.7",
    "ionic-plugin-keyboard": "2.2.1",
    "ionicons": "3.0.0",
    "jquery": "3.2.1",
    "lodash": "4.17.4",
    "phonegap-plugin-push": "1.10.5",
    "punycode": "2.1.0",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "ts-md5": "1.2.2",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.4",
    "@types/jquery": "2.0.46",
    "@types/lodash": "4.14.80",
    "ionic": "3.19.0",
    "typescript": "2.4.0"
  },
  "description": "Mobi**********Script",
  "cordova": {
    "plugins": {
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-whitelist": {},
      "es6-promise-plugin": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-screen-orientation": {},
      "ionic-plugin-deploy": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-compat": {},
      "cordova-plugin-geolocation": {},
      "call-number": {},
      "cordova-plugin-google-analytics": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-file": {},
      "cordova-plugin-advanced-http": {},
      "phonegap-plugin-push": {
        "SENDER_ID": "332793832935"
      },
      "mx.ferreyra.callnumber": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

I am also having the same issue. any update?

This is either a bad entry in your package.json
or
This is a problem with the RSMobile package, you would need to put an issue in on that repo

No the original page entry is different. I think that problem is not in it.

Yes. I deleted folders node_modules, plugins and platforms. Intalled it with npm i command. Build for one of platforms. After it I had to commit changes and made git push. I was work fine. And sure I was made issue to support. The answer is:
Hi Alexander,

Thanks for reaching out to the Ionic Pro support team.

I had a look and I see your app is using Ionic v3 but you’re committing your node_modules/ and www/ dirs. It’s not necessary to commit anything included in the default .gitignore file. Replace your .gitignore file with the one linked below.

After you’ve done that run the following.
git rm -r --cached .
git add .
This will remove everything and add it back in with the correct files ignored.

The best next step in debugging is to return to your local environment, clear your node modules, and try another build with a fresh install. To do that, follow these steps locally, in your app’s root directory:

  1. Delete the app’s node_modules/​ directory
  2. Delete the app’s package-lock.json​ file
  3. Run npm install​ (which will regenerate what you deleted above)
  4. Run npm run build​

If you see the same issue you saw when trying to build on our servers, this means there is an issue with your package.json​. The error messages should point you in the right direction of what needs to be updated.

I’d recommend running ionic doctor check​ to see what packages need an update.

Once everything is up to date, run npm install​ and npm run build​ again. Once the build completes locally, re-commit and git push again, and it should work on Ionic Pro as well.

Cheers,
Brian Manning | Customer Advocate | Ionic

1 Like

I’ll try it. Thank you!

The .gitignore and clearing cached worked perfectly for me. Thanks!