Cordova plugin geolocation not getting installed - ionic-framework

I am developing an ionic 4 application. I want to add geolocation plugin and use "ionic cordova plugin add cordova-plugin-geolocation" for the same. On executing the commandI get error
cordova.cmd plugin add cordova-plugin-geolocation
npm: Command failed with exit code 1 Error output:
npm ERR! code E400
npm ERR! 400 Bad Request - GET https://registry.npmjs.org/cordova-plugin-geolocation
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache\_logs\2019-09-10T08_17_48_727Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd plugin add cordova-plugin-geolocation exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.

Can you use below commands from you ionic project directory
ionic cordova plugin add cordova-plugin-geolocation
npm install #ionic-native/geolocation

Related

Error while getting native targets for android: No valid Android Emulator home found

root#ubuntu:/home/tesema/moodleapp# npm run prod:android
moodlemobile#4.1.0 prod:android /home/tesema/moodleapp
NODE_ENV=production ionic cordova run android --prod
[ERROR] Error while getting native targets for android: No valid Android Emulator home found.
This error occurred while using native-run. You can try running this command with --no-native-run, which will
revert to using Cordova.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! moodlemobile#4.1.0 prod:android: NODE_ENV=production ionic cordova run android --prod
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the moodlemobile#4.1.0 prod:android 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/2022-12-29T06_59_24_442Z-debug.log
I ma trining to build android APk file by using command npm run prod:android and shows the following error` but it will comply successfully using command npm start. Is there any one has the solution for the above error. how can I generate apk file for android studio

Ionic CLI V4 Looks like #ionic/v1-toolkit isn't installed in this project

After updating Ionic CLI to 4, every command I try to run does not working.
For example:
Ionic serve,
ionic cordova build android
ionic cordova run android
ionic cordova build ios
...
I receive such errors:
Looks like #ionic/v1-toolkit isn't installed in this project.
Then I try to install the package as they ask:
? Install #ionic/v1-toolkit? Yes
> npm i -D -E #ionic/v1-toolkit
But I get the following error in return:
npm WARN rsdemo.razwebs.co.il#1.1.1 No repository field.
npm WARN rsdemo.razwebs.co.il#1.1.1 No license field.
npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/razbuchnik/.npm/_logs/2018-08-17T05_49_32_425Z-debug.log
[ERROR] An error occurred while running subprocess npm.
npm i -D -E #ionic/v1-toolkit exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
net.js:705
throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
^
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or Buffer. Received type object
at WriteStream.Socket.write (net.js:705:11)
at process.<anonymous> (/usr/local/lib/node_modules/ionic/bin/ionic:9:63)
at process.emit (events.js:159:13)
at emitPendingUnhandledRejections (internal/process/promises.js:94:22)
at runMicrotasksCallback (internal/process/next_tick.js:124:9)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
How to solve this issue?
Try to delete node_modules directory and npm i again

cordova failed to download plugin cordova-custom-config

I've been trying exhaustingly to build my ionic app for both ios and android. I've added and removed platforms multiple times. Upgraded and downgraded my ionic app and java JDK but nothing works. Right now the common error seems to be with the plugin 'cordova-custom-config'.
When trying to add the ios platform through the command $ sudo ionic cordova platform add ios#latest --fetch --save --verbose the error is:
Discovered plugin "cordova-custom-config" in config.xml. Adding it to the project
Failed to restore plugin "cordova-custom-config" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin cordova-custom-config#^5.0.1 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 1
npm ERR! Command failed: /usr/local/bin/git clone -q git://github.com/xiangpingmeng/plist.js.git /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-87b2ddaf
npm ERR! /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-87b2ddaf/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamgoldberg/.npm/_logs/2018-02-07T04_04_30_105Z-debug.log
--save flag or autosave detected
Saving ios#latest into config.xml file ...
[ERROR] Exception:
When trying to add android platform through the command $ sudo ionic cordova platform add android#6.3.0 --fetch --save --verbose the error is the same as for ios. Please note that i'm adding android#6.3.0 and not android#latest because latest (7.0.0) is buggy.
When I try to add the cordova-custom-config plugin by itself through the command $ sudo cordova plugin add cordova-custom-config --fetch --verbose the error is:
(node:16626) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch plugin cordova-custom-config#^5.0.1 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 1
npm ERR! Command failed: /usr/local/bin/git clone -q git://github.com/xiangpingmeng/plist.js.git /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-0ad7ea7b
npm ERR! /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-0ad7ea7b/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamgoldberg/.npm/_logs/2018-02-07T04_12_20_482Z-debug.log
(node:16626) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Here is my ionic info
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
ios-sim : 6.0.0
Node : v8.8.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b
Environment Variables:
ANDROID_HOME : /Users/adamgoldberg/Library/Android/sdk
Misc:
backend : pro
It seems to be a problem when attempting to install into a project which previously contained an old version of the plugin.
Try cleaning out previous remnants:
rm -Rf node_modules/cordova-custom-config and rm -Rf plugins/cordova-custom-config
If still having issues, install with new cordova-fetch option
cordova plugin add cordova-custom-config --fetch
Go to plugin directory :
cd plugins/cordova-custom-config/
Install manually
npm install

Ionic 3 Google Maps Plugins

am using Ionic 3-Angular 4 to build an app, and I am trying to add Google Maps native SDK plugin and I keep getting the following Error:
Error: Failed to fetch plugin file:node_modules/cordova-plugin-googlemaps 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 4294963229 Error output:
npm ERR! path C:\Users\shawe\Desktop\Xampp Server\Ionic\beitelmagdes\node_modules\cordova-plugin-googlemaps\npm-shrinkwrap.json
npm ERR! code ELOOP
npm ERR! errno -4067
npm ERR! syscall open
npm ERR! ELOOP: too many symbolic links encountered, open 'C:\Users\shawe\Desktop\Xampp Server\Ionic\beitelmagdes\node_modules\cordova-plugin-googlemaps\npm-shrinkwrap.json'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\shawe\AppData\Roaming\npm-cache_logs\2017-11-16T07_43_23_428Z-debug.log
[ERROR] An error occurred while running cordova plugin add cordova-plugin-googlemaps --variable
API_KEY_FOR_ANDROID=AIza... (exit code 1).
Please Help
I was having the same problem and seemed to be an issue with the repro. It is now working nicely if you follow the ionic-native documentation:
https://ionicframework.com/docs/native/google-maps/
$ ionic cordova plugin add cordova-plugin-googlemaps --variable
API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable
API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"
$ npm install --save #ionic-native/google-maps

Ionic App Version

I can't install ionic native App Version.
When I write "ionic cordova plugin add cordova-plugin-app-version" shows next message:
How can I fix it??
λ ionic cordova plugin add cordova-plugin-app-version
> cordova plugin add cordova-plugin-app-version --save
× Running command - failed!
[ERROR] An error occurred while running cordova plugin add cordova-plugin-app-version --save (exit code 1):
Error: Failed to fetch plugin cordova-plugin-app-version 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 4294963229 Error output:
npm ERR! path C:\Users\Xu\Documents\github\rheumaiq_app\node_modules\es6-promise-plugin\package.json
npm ERR! code ELOOP
npm ERR! errno -4067
npm ERR! syscall open
npm ERR! ELOOP: too many symbolic links encountered, open
'C:\Users\Xu\Documents\github\rheumaiq_app\node_modules\es6-promise-plugin\package.json'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Xu\AppData\Roaming\npm-cache\_logs\2017-10-18T14_44_39_797Z-debug.log
UPDATE:
Thanks a lot!!
But the problem is not App Version, is with es6-promise-plugin in node_modules.
package.json
...
"es6-promise-plugin": "file:node_modules/es6-promise-plugin",
...
this folder is empty, I dont know what I have to do.
You have a typo
Here is how it should be
cordova plugin add cordova-plugin-appversion
Your mistake most likely results from the github repo being
https://github.com/Rareloop/cordova-plugin-app-version
But npm version name differs from the git repo name.
You can try cordovas --nofetch option to work around problems like this since cordova 7.0.0:
cordova plugin add cordova-plugin-appversion --nofetch
See the release notes for cordova 7.0.0 here to read more about the --nofetch mode.
The problem is not that it is empty, the problem is that it is a symbolic link that points to itself and therefore does not work. A loop is created.
If you delete the folder node_modules/es6-promise-plugin you will see that it is created again each time you type npm install...
I have seen this efect occurs adding the android platform, when try to do it for the cordova-plugin-x-socialsharing plugin, with the 5.2.1 version.
With the v5.2.0 that does not happen.
You can change your version:
ionic cordova plugin remove cordova-plugin-x-socialsharing --force
ionic cordova plugin add cordova-plugin-x-socialsharing#5.2.0 --force
Or you can change in your package.json the version to use.