How to solve Azure DevOps Ionic pipeline build error? - ionic-framework

I'm trying to build Ionic framework using Hosted macOS agent in Azure DevOps pipeline. I have the below build steps.
install npm#latest -g (NPM)
install -g #ionic/app-scripts#latest --save-dev (NPM)
npm i -g ionic#latest --verbose (Ionic CLI )
build ios (Ionic CLI )
But I'm getting the below error.
2018-11-15T02:36:25.4788550Z ==============================================================================
2018-11-15T02:36:25.4788690Z Task : Ionic Command
2018-11-15T02:36:25.4788740Z Description : Run an Ionic CLI command
2018-11-15T02:36:25.4788770Z Version : 1.3.12
2018-11-15T02:36:25.4788800Z Author : Microsoft Corporation
2018-11-15T02:36:25.4788900Z Help : [More Information](http://go.microsoft.com/fwlink/?LinkID=692057)
2018-11-15T02:36:25.4788940Z ==============================================================================
2018-11-15T02:36:25.9506080Z Module cache at /Users/vsts/.taco_home/node_modules
2018-11-15T02:36:26.9844280Z cordova already installed.
2018-11-15T02:36:26.9845750Z Cordova Module Path: /Users/vsts/.taco_home/node_modules/cordova/8.1.2/node_modules/cordova
2018-11-15T02:36:26.9849330Z Module cache at /Users/vsts/.taco_home/node_modules
2018-11-15T02:36:27.9211450Z ionic already installed.
2018-11-15T02:36:27.9213230Z Ionic Module Path: /Users/vsts/.taco_home/node_modules/ionic/4.3.1/node_modules/ionic
2018-11-15T02:36:28.4726980Z [WARN] ionic build is for building web assets and takes no arguments. See ionic build --help.
2018-11-15T02:36:28.4727450Z
2018-11-15T02:36:28.4727570Z Ignoring argument ios. Perhaps you meant ionic cordova build ios?
2018-11-15T02:36:28.4727640Z
2018-11-15T02:36:28.5020530Z > ionic-app-scripts build
2018-11-15T02:36:30.8035540Z [02:36:30] ionic-app-scripts 3.2.0
2018-11-15T02:36:30.8054190Z [02:36:30] build dev started ...
2018-11-15T02:36:30.8621960Z [02:36:30] ionic-app-script task: "build"
2018-11-15T02:36:30.8622700Z [02:36:30] Error: ENOENT: no such file or directory, open
2018-11-15T02:36:30.8623700Z '/Users/vsts/agent/2.142.1/work/1/s/MyApp/node_modules/#angular/core/package.json'
2018-11-15T02:36:30.8630180Z Error: ENOENT: no such file or directory, open '/Users/vsts/agent/2.142.1/work/1/s/MyApp/node_modules/#angular/core/package.json'
2018-11-15T02:36:30.8632330Z at Error (native)
2018-11-15T02:36:30.8807840Z [ERROR] An error occurred while running subprocess ionic-app-scripts.
2018-11-15T02:36:30.8808230Z
2018-11-15T02:36:30.8809020Z ionic-app-scripts build exited with exit code 1.
2018-11-15T02:36:30.8809110Z
2018-11-15T02:36:30.8809730Z Re-running this command with the --verbose flag may provide more information.
2018-11-15T02:36:30.9233030Z ##[error]Task failed
2018-11-15T02:36:30.9263660Z ##[section]Finishing: Ionic Command build ios

Related

Unable to build android in IONIC 6

When I run ionic cordova build android –prod i get the error:
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Exception in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-7.1.1-all.zip failed: timeout
I'm behind a proxy, so I set
ionic config set -g proxy http://proxy-..***:9999
I have executed ionic start myApp tabs --cordova --type=angular
I have executed ionic serve
but i can't do the build
I will be very grateful if you can help me please.
Ionic:
Ionic CLI: 6.20.3
Ionic Framework: #ionic/angular 6.3.2
Cordova:
Cordova CLI: 11.0.0
Cordova Platforms: android 10.1.2
Utility:
cordova-res: not installed globally
native-run: not installed globally
System:
NodeJS: v16.17.0 (C:\Program Files\nodejs\node.exe)
npm: 8.15.0
OS: Windows 10
Make sure you already added android in your ionic app then proceed on these steps.
Download the gradle: https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Place the zip file inside: {YourAppName}/platforms/android/gradle
Set an environment variable in your OS: CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="../gradle-7.1.1-all.zip"
Run ionic cordova build android --prod

Unable to build android apk file from ionic framework

I am new to IONIC. My problem is that I am trying to build an apk file using downloaded project. I getting an error. Attaching my logs for reference. Any help would be great
Using this command to build apk ionic cordova build android --prod --release
> ionic-v1.cmd build
[17:21:38] Invoking sass gulp task.
> cordova.cmd build android --release
Running command: node E:\Ionic Projets\zmNinja-master\hooks\before_prepare\02_jshint.js E:\Ionic Projets\zmNinja-master
cordova-custom-config: Skipping auto-restore of config file backup(s)
Running command: node E:\Ionic Projets\zmNinja-master\hooks\after_prepare\010_add_platform_class.js E:\Ionic Projets\zmNinja-master
Running command: node E:\Ionic Projets\zmNinja-master\hooks\after_prepare\020_remove_sass_from_platforms.js E:\Ionic Projets\zmNinja-master
Using "requireCordovaModule" to load non-cordova module "glob" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.```

ionic 4 beta No installed build tools found

I’m trying to compile android apk, but I get the error “No installed build tools found.”
$ ionic cordova build android
Error:
...
Android Studio project detected
Preparing Firebase on Android
ANDROID_HOME=/usr/lib/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* Where:
Script '/home/ubuntu/lapp/platforms/android/CordovaLib/cordova.gradle' line: 68
* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> No installed build tools found. Install the Android build tools version 19.1.0 or higher.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
/home/ubuntu/lapp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Script '/home/ubuntu/lapp/platforms/android/CordovaLib/cordova.gradle' line: 68
* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> No installed build tools found. Install the Android build tools version 19.1.0 or higher.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
[ERROR] An error occurred while running subprocess cordova.
cordova build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Environment Variables:
export ANDROID_HOME=/home/ubuntu/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
$ echo $ANDROID_HOME
/home/ubuntu/Android/Sdk
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
$ echo $PATH
...
/usr/lib/jvm/java-8-oracle/bin:
/usr/lib/jvm/java-8-oracle/db/bin:
/usr/lib/jvm/java-8-oracle/jre/bin:
/home/ubuntu/Android/Sdk/platform-tools:
/home/ubuntu/Android/Sdk/tools:
/home/ubuntu/Android/Sdk/build-tools:
/home/ubuntu/Android/Sdk/tools/bin:
/home/ubuntu/Android/Sdk/emulator
.
$ ionic info
Ionic:
ionic (Ionic CLI) : 4.6.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : #ionic/angular 4.0.0-rc.0
#angular-devkit/build-angular : 0.11.4
#angular-devkit/schematics : 7.1.4
#angular/cli : 7.1.4
#ionic/angular-toolkit : 1.2.2
Cordova:
cordova (Cordova CLI) : not installed
Cordova Platforms : not available
Cordova Plugins : not available
System:
Android SDK Tools : 26.1.1 (/home/ubuntu/Android/Sdk)
NodeJS : v10.14.2 (/usr/local/bin/node)
npm : 6.4.1
OS : Linux 4.15
I try:
ionic cordova platform remove android
ionic cordova platform add android
After all this, I installed all the SDKs from Android 4.3 and all Android SDK build-tools from 19.0.3, but even this did not help.
Ps: No matter how I try to set the path to ANDROID_HOME (~/.bash_profile, ~/.bashrc), but still takes ANDROID_HOME=/usr/lib/android-sdk
any ideas?
1) Terminal as root
$ sudo -s
2) Add path to ~/.bash_profile or ~/.bashrc
3) Done!

ionic cordova build android - Ionic Woocommerce app not build

Ionic cordova build error
Command
cordova build android
Gives output:
Android Studio project detected
ANDROID_HOME=C:\Users\Clide\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
[ERROR] An error occurred while running subprocess cordova.
cordova build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.

Ionic platforms update returns an error

I just update to ionic beta usin the command lin npm install -g ionic#beta
whenever i run ionic platforms update ios/android
I got this error:
[ERROR] Unknown plugin: #ionic/cli-plugin-.
If you run ionic info what version of the ionic CLI are you running it looks like you have updated to V3.
If so then you need to update your command to be:
ionic cordova:platform update android
More info about CLI changes here - https://github.com/driftyco/ionic-cli/blob/v3/docs/cordova-platform.md