Ionic AppFlow Build Error

Hi All
I have recently started using Ionic Appflow. i am trying to get apk file and then ios files.

I have uploaded my lastest project on to Github, but when i try to build the project on appflow i get the following errors. Can you someone advice me what could be wrong?

Failed
Running with gitlab-runner 11.3.1 (0aa5179e)
on Ionic Package Android Runner f537d27d
Using Kubernetes namespace: ionic-runners
Using Kubernetes executor with image 319312831725.dkr.ecr.us-west-2.amazonaws.com/ionic-runners/package-android 

Waiting for pod ionic-runners/runner-f537d27d-project-0-concurrent-2nqpqx to be running, status is Pending
Waiting for pod ionic-runners/runner-f537d27d-project-0-concurrent-2nqpqx to be running, status is Pending
Waiting for pod ionic-runners/runner-f537d27d-project-0-concurrent-2nqpqx to be running, status is Pending
Waiting for pod ionic-runners/runner-f537d27d-project-0-concurrent-2nqpqx to be running, status is Pending
Waiting for pod ionic-runners/runner-f537d27d-project-0-concurrent-2nqpqx to be running, status is Pending
Waiting for pod ionic-runners/runner-f537d27d-project-0-concurrent-2nqpqx to be running, status is Pending
Running on runner-f537d27d-project-0-concurrent-2nqpqx via gitlab-runner-5dd8687545-bg9ks

Cloning repository

Cloning into ‘/builds/aardrasystems/app’

Checking out 84f246f4 as master

Skipping Git submodules setup
$ run “fetch-updates”
$ run “build-android”
[20:11:35]: You have required a gem, if this is a third party gem, please use fastlane_require 'securerandom' to ensure the gem is installed locally.
[20:11:35]: ------------------------------
[20:11:35]: — Step: default_platform —
[20:11:35]: ------------------------------
[20:11:35]: Driving the lane ‘android package_build’ :rocket:
[20:11:35]: ---------------------------
[20:11:35]: — Step: build_summary —
[20:11:35]: ---------------------------

±--------------------±--------------------------+
| Build Summary |
±--------------------±--------------------------+
| Job ID | 6495824 |
| Node.js version | v8.12.0 |
| Cordova CLI version | 9.0.3 (cordova-lib@9.0.2) |
| npm version | 6.4.1 |
±--------------------±--------------------------+

20:11:37: — Step: add_git_credentials —
20:11:37: ---------------------------------
20:11:37: Writing git-credentials files
20:11:37: git-credentials successfully added to project
20:11:37: -------------------------------
20:11:37: — Step: modify_config_xml —
20:11:37: -------------------------------
20:11:37: No custom native config detected.
20:11:37: ---------------------------
20:11:37: — Step: build_pro_app —
20:11:37: ---------------------------
20:11:37: Installing Dependencies
20:11:37: $ npm install --quiet --no-optional
[20:11:48]: ▾ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules/fsevents):
[20:11:48]: ▾ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
[20:11:48]: ▾ audited 52283 packages in 10.768s
[20:11:48]: ▾ found 1 high severity vulnerability
[20:11:48]: ▾ run npm audit fix to fix them, or npm audit for details
[20:11:48]: Build script detected

[20:11:48]: $ npm run build
[20:11:48]: ▾ > aardraapp@0.0.1 build /builds/aardrasystems/app
[20:11:48]: ▾ > ng build
[20:11:48]: ▾ sh: 1: ng: Permission denied
[20:11:48]: ▾ npm ERR! code ELIFECYCLE
[20:11:48]: ▾ npm ERR! errno 126
[20:11:48]: ▾ npm ERR! aardraapp@0.0.1 build: ng build
[20:11:48]: ▾ npm ERR! Exit status 126
[20:11:48]: ▾ npm ERR!
[20:11:48]: ▾ npm ERR! Failed at the aardraapp@0.0.1 build script.
[20:11:48]: ▾ npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[20:11:48]: ▾ npm ERR! A complete log of this run can be found in:
[20:11:48]: ▾ npm ERR! /root/.npm/_logs/2019-04-19T20_11_48_894Z-debug.log
±-----------------±----------------------+
| Lane Context |
±-----------------±----------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | android |
| LANE_NAME | android package_build |
±-----------------±----------------------+
[20:11:48]: Exit status of command ‘npm run build’ was 126 instead of 0.

aardraapp@0.0.1 build /builds/aardrasystems/app
ng build

sh: 1: ng: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! aardraapp@0.0.1 build: ng build
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the aardraapp@0.0.1 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! /root/.npm/_logs/2019-04-19T20_11_48_894Z-debug.log

/usr/local/bin/fastlane: [!] Exit status of command ‘npm run build’ was 126 instead of 0. (FastlaneCore::Interface::FastlaneShellError)

aardraapp@0.0.1 build /builds/aardrasystems/app
ng build

sh: 1: ng: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! aardraapp@0.0.1 build: ng build
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the aardraapp@0.0.1 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! /root/.npm/_logs/2019-04-19T20_11_48_894Z-debug.log

±-----±--------------------±------------+
| fastlane summary |
±-----±--------------------±------------+
| Step | Action | Time (in s) |
±-----±--------------------±------------+
| 1 | default_platform | 0 |
| 2 | build_summary | 2 |
| 3 | add_git_credentials | 0 |
| 4 | modify_config_xml | 0 |
| :boom: | build_pro_app | 11 |
±-----±--------------------±------------+

[20:11:48]: fastlane finished with errors
Running after script

$ run “clean-up”
ERROR: Job failed: command terminated with exit code 1

anyone who can advice where i am going wrong?

Hello @aardra how were you able to fix this?

This typically happens in Appflow because the build process runs as root. You can fix it by adding a .npmrc file to the root of the project with the following contents.

unsafe-perm=true

When you build locally as a user this is the default. Adding this won’t change anything when building as a user other than root.

see: https://docs.npmjs.com/cli/v6/using-npm/config#unsafe-perm

3 Likes