Failed to add android platform to an ionic project - android

IM TRYING TO BUILD AN APK AND I GET THIS ERROR
Discovered saved plugin "im.ltdev.cordova.UserAgent". Adding it to the project
Failed to restore plugin "im.ltdev.cordova.UserAgent" from config.xml. You might need to try adding it again. Error: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code E404
npm ERR! 404 Not found : im.ltdev.cordova.UserAgent
npm ERR! 404
npm ERR! 404 'im.ltdev.cordova.UserAgent' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Desarrollo\AppData\Roaming\npm-cache\_logs\2020-01-28T17_27_27_131Z-debug.log
Discovered saved plugin "cordova-plugin-firebase". Adding it to the project
Failed to restore plugin "cordova-plugin-firebase" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin git+https://github.com/dpa99c/cordova-plugin-firebase.git#GH-1057-April-05-android-build-issue via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOGIT
npm ERR! Error while executing:
npm ERR! undefined ls-remote -h -t https://github.com/dpa99c/cordova-plugin-firebase.git
npm ERR!
npm ERR! undefined
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Desarrollo\AppData\Roaming\npm-cache\_logs\2020-01-28T17_27_31_601Z-debug.log
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\Users\Desarrollo\Desktop\lugus-3-0\platforms\android\app\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\Users\Desarrollo\Desktop\lugus-3-0\platforms\android\cordova-android-support-gradle-release\SanDiego-cordova-android-support-gradle-release.gradle
cordova-plugin-androidx: Updated gradle.properties to enable AndroidX
cordova-plugin-androidx-adapter: Processed 18 Java source files in 450ms
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
THIS IS MY IONIC INFO
Ionic:
Ionic CLI : 5.4.15 (C:\Users\Desarrollo\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : #ionic/angular 4.0.0-beta.17
#angular-devkit/build-angular : 0.803.23
#angular-devkit/schematics : 7.0.7
#angular/cli : 7.0.7
#ionic/angular-toolkit : 1.2.0
Cordova:
Cordova CLI : not installed
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 2.5.2, (and 10 other plugins)
Utility:
cordova-res : 0.9.0
native-run : not installed
System:
NodeJS : v11.1.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

It seems you have wrong node-module name in package.json.
Please update your package.json to use cordova-plugin-agent , clean up your node_modules directory and NPM cache and install it again.
Hope it helps.
Also please refer to this issue here on github that has same info:

Related

npm errors when the ionic/cordova plugin uses --variable

I have been going through a nightmare so I'd be grateful for any pointer you might have for the below issue.
I have an ionic project that worked perfectly fine and as I was preparing for the final build to push the apk to production, I probably updated something (cordova, npm or ionic) and now cannot install a package if there is a --variable. For instance, the below command
ionic cordova plugin add cordova-plugin-play-games-services --variable APP_ID="XXXXXXX"
throws the following error:
Adding cordova-plugin-play-games-services to package.json
npm: Command failed with exit code 1 Error output:
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "APP_ID=XXXXXXXX": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/myuser/.npm/_logs/2019-11-22T15_05_18_908Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
cordova plugin add cordova-plugin-play-games-services APP_ID=XXXXXXXX exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
The following command on the other hand
ionic cordova plugin add cordova-plugin-admob-free --variable ADMOB_APP_ID="XXXXXXXXXXXXXXX"
gives
Adding cordova-plugin-admob-free to package.json
npm: Command failed with exit code 1 Error output:
npm ERR! code E404
npm ERR! 404 'MyApp' is not in the npm registry.
npm ERR! 404 name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 'MyApp#latest' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/myuser/.npm/_logs/2019-11-22T15_10_22_657Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
I can install packages just fine if there is no use of --variable. I have the following environment:
npm -v: 6.12.1
cordova -v: 9.0.0 (cordova-lib#9.0.1)
ionic -v: 5.4.7
I initially thought my npm registry was the problem. I reinstalled it and reinstalled ionic and cordova, which led to no change. I, in fact, created even a brand new linux partition and installed everything from scratch and still get the above problems!
I'd be grateful if you could help me out of this nightmare!
Huge thanks in advance,
Doug

Error while trying to install ionic on ubuntu 18.04

How to install ionic 4 in ubuntu 18.04.Which version of npm nodejs cordova android sdk should go hand in hand for installing ionic 4 on ubuntu 18.04.Please do help me.I tried installing but i am getting error when i run the project.
npm ERR! Linux 4.15.0-20-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code Unknown system error -122
npm ERR! errno -122
npm ERR! syscall close
Try this script: Ionic Cordova installer for Ubuntu
Its will Automatically install all required things. Your just have to update after this script.

I'm unable to add android platform in ionic

From today i am facing a problem in ionic to add android platform.
when i run ionic cordova platform add android i found following Error:
Please help me.
C:\Users\kamal\Desktop\desktop>ionic cordova platform add android
[INFO] Enabling Cordova integration.
ionic config set integrations.cordova {} --json --force
[OK] integrations.cordova set to {} in .\ionic.config.json!
cordova platform add android --save
× Running command - failed!
[ERROR] Exception: Using cordova-fetch for cordova-android#~6.3.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.ionic.starter
Name: MyApp
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android#6.3.0
Discovered plugin "ionic-plugin-keyboard" in config.xml. Adding it to the project
Installing "ionic-plugin-keyboard" for android
Adding ionic-plugin-keyboard to package.json
Saved plugin info for "ionic-plugin-keyboard" to config.xml
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a
previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project
Failed to restore plugin "cordova-plugin-statusbar" from config.xml. You might need to try adding it again.
Error: Failed to fetch plugin https://github.com/apache/cordova-plugin-statusbar.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! git clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892:
Cloning into
'C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892'...
npm ERR! git clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892:
git-upload-pack
'C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92':
git-upload-pack: command not found
npm ERR! git clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892:
fatal: Could not read from remote repository.
npm ERR! git clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892:
npm ERR! git clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892:
Please make sure you have the correct access rights
npm ERR! git clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892:
and the repository exists.
npm ERR! git clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892:
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
"https://github.com/apache/cordova-plugin-statusbar.git" "--production" "--save"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! code 128
npm ERR! Command failed: git -c core.longpaths=true clone
C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892
npm ERR! Cloning into
'C:\Users\kamal\AppData\Local\Temp\npm-5316-596ddc1c\git-cache-f1f0edfd\08127bf674bcfc5a161466a4c19e8fd21f726892'...
npm ERR! git-upload-pack
'C:\Users\kamal\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92':
git-upload-pack: command not found
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\kamal\Desktop\desktop\npm-debug.log
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Installing "cordova-plugin-device" for android
Adding cordova-plugin-device to package.json
Saved plugin info for "cordova-plugin-device" to config.xml
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project
Installing "cordova-plugin-splashscreen" for android
Adding cordova-plugin-splashscreen to package.json
Saved plugin info for "cordova-plugin-splashscreen" to config.xml
Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding it to the project
Installing "cordova-plugin-ionic-webview" for android
Adding cordova-plugin-ionic-webview to package.json
Saved plugin info for "cordova-plugin-ionic-webview" to config.xml
--save flag or autosave detected
Saving android#~6.3.0 into config.xml file ...
My ionic info
#ionic/cli-utils : 1.13.0
ionic (Ionic CLI) : 3.13.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.0.0
Cordova Platforms : none
Ionic Framework : ionic-angular 3.7.1
System:
Android SDK Tools : 26.1.1
Node : v6.11.4
npm : 3.10.10
OS : Windows 10
Misc:
backend : pro
try installing the 6.11.4 LTS version of node.js (marked as recommended for most users)

ionic 2: ionic run android shows error

i have error when i run "ionic run android" or "ionic build android" in my ionic 2 app
this is the error i get. i just tryinh to see my app in the emulator of android.
i tried to make new ionic 2 project but it's the same problem.
Running 'build:before' npm script before build
> ionic-hello-world# build C:\Users\Adir\MyApps\tasklist
> ionic-app-scripts build --rollup ./config/rollup.config.js
[20:16:33] ionic-app-scripts 0.0.30
[20:16:33] build prod started ...
[20:16:33] clean started ...
[20:16:33] clean finished in 24 ms
[20:16:33] copy started ...
[20:16:33] ngc started ...
[20:16:33] lint started ...
[20:16:33] copy finished in 182 ms
[20:16:34] lint finished in 770 ms
[20:16:52] ngc finished in 18.71 s
[20:16:52] bundle prod started ...
[20:16:52] bundle prod failed: Could not resolve entry (/app/main.prod.ts)
[20:16:52] Error: Could not resolve entry (/app/main.prod.ts)
at C:\Users\Adir\MyApps\tasklist\node_modules\rollup\dist\rollup.js:8635:28
at process._tickCallback (internal/process/next_tick.js:103:7)
Error running ionic app script "build": Error: Could not resolve entry (/app/main.prod.ts)
npm
ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world# build: `ionic-app-scripts build --rollup ./config/rollup.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world# build script 'ionic-app-scripts build --rollup ./config/rollup.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!
ionic-app-scripts build --rollup ./config/rollup.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Adir\MyApps\tasklist\npm-debug.log
Caught exception:
undefined
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
C:\Users\Adir\MyApps\tasklist>
This has been a common issue lately with ionic and A2 and resolving main.prod.*Try updating you app scripts for the project.
npm install #ionic/app-scripts#latest
Your error message should change after that with what is actually causing your build to crash. If the error message changes please update your question with the new message.
Checkout this out as well for more information on this issue: Ionic forum
Close all ionic folders and serve or lab. And try again, ionic cordova build android.
First of all, Check the version of Android in package.json file.
Now remove platform with this command (ionic cordova platform rm android)
After that addd the platform with this command (ionic cordova platform add
android#6.4.0). Where 7.0.0 is not stable version so use 6.4.0
Now, run this command (ionic cordova run android) or in mac (sudo ionic cordova run android)
Try out below command
$ cordova clean android
$ cordova build android
$ ionic cordova build android
There is a path setup problem in your system.
1st check npm version using CMD: npm -v
If it shows version number then use below code, otherwise 1st setup your npm path, you can use gitbash cmd, nodejs cmd
Try to use
ionic cordova run android
or
ionic cordova platform remove android
ionic cordova run android
If you have MAC system must use sudo like
sudo ionic cordova run android

Ionic is Not Installing on Windows 7 - Getting Many Errors

I am getting this error while i am trying to install Ionic
$ npm install ionic cordova -g
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.2.2","npm":"2.14.7"})
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\delayed-stream\0.0.5\package.tgz
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "ionic" "cordova" "-g"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! path C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed
npm ERR! code UNKNOWN
npm ERR! errno -4094
npm ERR! syscall scandir
npm ERR! UNKNOWN: unknown error, scandir 'C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! error rolling back Error: UNKNOWN: unknown error, scandir 'C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: UNKNOWN: unknown error, scandir 'C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed']
npm ERR! error rolling back errno: -4094,
npm ERR! error rolling back code: 'UNKNOWN',
npm ERR! error rolling back syscall: 'scandir',
npm ERR! error rolling back path: 'C:\\Users\\Sridhar\\AppData\\Roaming\\npm\\node_modules\\ionic\\node_modules\\npm\\node_modules\\read-installed' }
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Sridhar\npm-debug.log
Please help me to install Ionic
Please follow the below steps to install ionic.
IONIC Setup
Setup Environment (Installations)
Install Node.js
a. http://nodejs.org/download/
install ionic framework
a. $ npm install -g cordova ionic
install android SDK and set environment variables
a. Set following environment variable
b. set ANDROID_HOME=C:\\android-sdk-windows
Install Android Target 19 (follow following steps)
Open the SDK Manager (typing android into the terminal, assuming it's in your file path)
Selected box next to Android 4.4.2 (API 19)
Clicked button Install 8 packages
Install ant using CMD window
npm Install -g ant
a. Add following path in environment variables (PATH):
C:\Users\user.name\AppData\Roaming\npm\node_modules\ant\ant\bin
Once you setup the ionic environment.
Create the basic application for testing.
Open node.js command prompt
ionic start myApp tabs
cd myApp
ionic serve (it will open the application in browser)
ionic platform add android (replace ios with android if you want to add iOS platform)
ionic build android (replace ios with android if you want to build in iOS platform)
ionic emulate android android (replace ios with android if you want to emulate iOS platform)
NOTE: If ERR occurs, follow below link:
installing ionic npm ERR! tar.unpack error
Have you followed the right installation sequence ?
Install or update Node.js
Download the most recent version of Node.js. If you are running an older version of Node, make sure to update it because older versions had issues with npm.
As with the other commands, nodejs should now function in cmd.exe but just to be careful, add the full path to the bin folder in Node to your PATH, which will look something like C:\Program Files\nodejs\bin
Install Cordova
Open a new cmd.exe window, and run:
$ npm install -g cordova
Install Ionic
$ npm install -g ionic
Find the official installation doc and this too for more.

Categories

Resources