cordova add plugin - unable to access - plugins

I am trying to add a plugin to Cordova via
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
git itself seems to run fine. Running the following works:
git clone "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" "D:\Temp\plugman-tmp1390234462383"
This is what is used in plugins.js line 43 (var cmd = util.format(...)).
The error I receive using the cordova plugin add ... is:
Calling plugman.fetch on plugin "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git"
Fetching plugin from "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git"...
Fetching plugin via git-clone command: git clone "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" "D:\Temp\plugman-tmp1390235833828"
C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:126
throw e;
^
Error: Fetching plugin failed: Error: Command failed: Cloning into 'D:\Temp\plugman-tmp1390234462383'...
fatal: unable to access 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git/': Failed connect to git-wip-us.apache.org:443; No error
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\src\plugin.js:90:41
at _rejected (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:24)
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:834:30
at Promise.when (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:752:41)
at C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:574:44
at flush (C:\Users\myUser\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
Any idea?
Some more information:
I am going through a proxy, but I set this for git and for npm. I installed Cordova via "npm install cordova" and the project via "cordova create TestApp", I added platforms via "cordova platform add android" and I can run the app on the emulator.
I even tried "phonegap local plugin add https..." with the same result.
All that is missing for me is to add plugins.

Sometimes a Cordova update will cause problems with npm and will corrupt the "cordova cache" that NPM uses to quickly download different Cordova versions. I know there were problems with the server pushing the latest Cordova plugins to NPM, so maybe this is why you're having trouble.
I'd suggest deleting /AppData/Roaming/npm/node_modules/cordova direct in its entirety, than installing a fresh new copy with npm install -g cordova. This shouldn't remove any of your Cordova projects, it will just download a fresh set of the tools. When you run cordova commands, it might take longer the first time since the tools will have to go to the git repo's and fetch the content fresh.

Tried clearing the cordova cache by deleting the folder as suggested by #mbillau but that didn't help. I search for the plugin where I was getting the error and tried installing through command line but got the same error message. Finally the solution that worked for me:
open important files in your IDE
open Cordova plugins
replace all "https://git-wip-us.apache.org/repos/asf/" with "https://git.apache.org/"
and it worked perfectly.

Replace "git-wip-us.apache.org/repos/asf7" with "github.com/apache/"
Like #Max said.

Checking the apache site (either https://git-wip-us.apache.org/repos/asf/, https://gitbox.org/repos/asf/, or https://git.apache.org/) I only see commit logs instead of the sources.
The sources can be found on GitHub. This worked for me:
cordova plugin add https://github.com/apache/cordova-plugin-device.git

Related

How to Create Custom SplashScreen on Ionic?

I want show custom splash screen with animation. I tried add LottieSplashScreen plugin but i can't do this.
Tried with this code
cordova plugin add cordova-plugin-lottie-splashscreen
But i facing
'sh' is not recognized as an internal or external command,
operable program or batch file.
Failed to install 'cordova-plugin-lottie-splashscreen': Error: Hook failed with error code ENOENT: C:\Users\bbara\Desktop\GuvercinSepetim\plugins\cordova-plugin-lottie-splashscreen\hooks\ios\update_pod_repo.sh
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:224:23
at _rejected (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:864:24)
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:890:30
at Promise.when (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1142:31)
at Promise.promise.promiseDispatch (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:41)
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
at processTicksAndRejections (internal/process/next_tick.js:74:9)
Hook failed with error code ENOENT: C:\Users\bbara\Desktop\GuvercinSepetim\plugins\cordova-plugin-lottie-splashscreen\hooks\ios\update_pod_repo.sh
You are running a cordova node but not ionic cordova:
cordova plugin add cordova-plugin-lottie-splashscreen
According to ionic documentation:
npm install #ionic-native/lottie-splash-screen
ionic cordova plugin add cordova-plugin-lottie-splashscreen
And here is the referance:
https://ionicframework.com/docs/native/lottie-splash-screen
And here is the github reposatory of the plugin :
https://github.com/timbru31/cordova-plugin-lottie-splashscreen
Try looking into Capacitor instead of Cordova. You can still use all your Cordova libraries, but the Capacitor build is a bit cleaner. I followed this tutorial and found it very useful with good tools. It worked for me first time, which is never the case with some Ionic stuff!
https://enappd.com/blog/icon-splash-in-ionic-react-capacitor-apps/114/
The issue you are describing was fixed in the v0.8.1 release. It originated from preparing/building the iOS platform on a Windows machine - which won't work anyways. Because cordova-ios supports recent Pod installations out of the box, it's no longer required to sync the repo, i.e, the hook is obsolete. However, the lottie plugin won't fail anymore.
Side note: I'm the author of this plugin.

Ionic config directory error. (How to solve)

I have a issue using ionic on my mac. I've cloned my repo and started it with ionic serve. But if I use control C and stop the command ant start it again I get this error "Cannot read property 'IONIC_CONFIG_DIRECTORY' of undefined".
Same problem here. Found the solution: https://forum.ionicframework.com/t/ionic-commands-not-working-after-update-ionic/146492/3
Solution:
npm uninstall ionic cordova
npm install ionic cordova

IONIC Package Failed to install ‘onesignal-cordova-plugin’: Error: pod: Command failed with exit code 31

I’m trying to use ionic pro packaging (https://ionicframework.com/pro/package). When building to android everything works fine. But building to IOS gives me this error:
Looking for related GitHub issues on fastlane/fastlane…
\e[91mFailed to upload ipa to storage please retry your build.\e[0m
MAC Iteration 1
MAC verified OK
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
Certificate bag
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048
/Users/ionic/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.75.1/fastlane_core/lib/fastlane_core/ui/interface.rb:145:in `shell_error!’: [!] Exit status of command ‘cordova platform add ios --nofetch’ was 1 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
Adding ios project…
Creating Cordova project for the iOS platform:
Path: platforms/ios
Package: com.notified.x
Name: Notified
iOS project created with cordova-ios#4.5.4
Discovered plugin “cordova-plugin-whitelist” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-whitelist#^1.3.3” via npm
Installing “cordova-plugin-whitelist” for ios
Adding cordova-plugin-whitelist to package.json
Saved plugin info for “cordova-plugin-whitelist” to config.xml
Discovered plugin “cordova-plugin-device” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-device#^2.0.2” via npm
Installing “cordova-plugin-device” for ios
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
Fetching plugin “cordova-plugin-splashscreen#^5.0.2” via npm
Installing “cordova-plugin-splashscreen” for ios
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
Fetching plugin “cordova-plugin-ionic-webview#^1.2.1” via npm
Installing “cordova-plugin-ionic-webview” for ios
Adding cordova-plugin-ionic-webview to package.json
Saved plugin info for “cordova-plugin-ionic-webview” to config.xml
Discovered plugin “cordova-plugin-ionic-keyboard” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-ionic-keyboard#^2.1.2” via npm
Installing “cordova-plugin-ionic-keyboard” for ios
Adding cordova-plugin-ionic-keyboard to package.json
Saved plugin info for “cordova-plugin-ionic-keyboard” to config.xml
Discovered plugin “cordova-plugin-app-name” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-app-name#^1.0.4” via npm
Installing “cordova-plugin-app-name” for ios
Adding cordova-plugin-app-name to package.json
Saved plugin info for “cordova-plugin-app-name” to config.xml
Discovered plugin “cordova-plugin-inappbrowser” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-inappbrowser#^3.0.0” via npm
Installing “cordova-plugin-inappbrowser” for ios
Adding cordova-plugin-inappbrowser to package.json
Saved plugin info for “cordova-plugin-inappbrowser” to config.xml
Discovered plugin “cordova-plugin-statusbar” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-statusbar#^2.4.2” via npm
Installing “cordova-plugin-statusbar” for ios
Adding cordova-plugin-statusbar to package.json
Saved plugin info for “cordova-plugin-statusbar” to config.xml
Discovered plugin “cordova-plugin-ionic” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-ionic#^4.1.7” via npm
Installing “cordova-plugin-ionic” for ios
Plugin dependency “cordova-plugin-splashscreen#5.0.2” already fetched, using that version.
Dependent plugin “cordova-plugin-splashscreen” already installed on ios.
Adding cordova-plugin-ionic to package.json
Saved plugin info for “cordova-plugin-ionic” to config.xml
Discovered plugin “cordova-plugin-cocoapod-support” in config.xml. Adding it to the project
Fetching plugin “cordova-plugin-cocoapod-support#^1.5.0” via npm
Installing “cordova-plugin-cocoapod-support” for ios
Adding cordova-plugin-cocoapod-support to package.json
Saved plugin info for “cordova-plugin-cocoapod-support” to config.xml
Discovered plugin “onesignal-cordova-plugin” in config.xml. Adding it to the project
Fetching plugin “onesignal-cordova-plugin#^2.1.0” via npm
Installing “onesignal-cordova-plugin” for ios
Failed to install ‘onesignal-cordova-plugin’: Error: pod: Command failed with exit code 31
at ChildProcess.whenDone (/Users/ionic/builds/TechNotified/notified-mobile-app/platforms/ios/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
Failed to restore plugin “onesignal-cordova-plugin” from config.xml. You might need to try adding it again. Error: Error: pod: Command failed with exit code 31
Searching for new pods
Checking config.xml for pods.
Installing pods
Sit back and relax this could take a while.
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 0 dependencies from the Podfile and 0 total pods installed.
[!] The Podfile does not contain any dependencies.
Updating ios build to use workspace.
Adding schemes
–save flag or autosave detected
Saving ios#~4.5.4 into config.xml file …
I’ve installed cocoa pods but that didn’t help.
A lot of threads tells me to do this: “Run pod repo update first. I had the same issue and it helped.” but that is only possible on OS X i think?
I have spent almost a day on this thing now. As usual the ionic documentation only says something like “Click the build button and it’s all done”. https://ionicframework.com/docs/pro/package/
I solved it by doing this steps: Package native binaries Failed to install 'onesignal-cordova-plugin' then i still got the same error and noticed it said version "^2.1.0" instead of just "2.1.0" on the onesignal-cordova-plugin error line. So i found that it still had the "^" in the version number in both the config.xml and the package.json file. When i removed both it worked!

Ionic push plugin error in installation

When i tried to add ionic push plugin using
ionic plugin add https://github.com/phonegap-build/PushPlugin.git
i got following error in command promp
Updated the hooks directory to have execute permissions Fetching plugin "https://github.com/phonegap-build/PushPlugin.git" via git clone Repository "https://github.com/phonegap-build/PushPlugin.git" checked out to git ref "master". shell.js: internal error Error: EXDEV, cross-device link not permitted 'C:\Users\A-25\AppData\Local\Temp\git\1438839071751\Example'
at Error (native)
at Object.fs.renameSync (fs.js:636:18)
at C:\Users\A-25\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\mv.js:77:8 at Array.forEach (native)
at Object._mv (C:\Users\A-25\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\mv.js:53:11)at Object.mv (C:\Users\A-25\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\common.js:186:23)
at C:\Users\A-25\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\util\plugins.js:53:19
at _fulfilled (C:\Users\A-25\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\A-25\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\A-25\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:749:13)
can anybody tell me what's the problem?
i just downgrade my cordova version to 5.0.0 and it works
Without downgrading your cordova version you could try this
ionic plugin add cordova-plugin-push-notification
I had a similar question:
From an official blog post, Cordova is moving their plugins to npm.
I had the same problem with the ionic plugin add ... command that Mudasser mentioned. So, I installed it easily now with npm:
npm install phonegap-plugin-push

Phonegap add plugin fails (errno 34) */plugin.xml

When I add a plugin to a 3.0.0 phonegap project with an android platform, I have an error eventhough a bunch of files for the plugin are added. In addition to that error when I add it, the Android manifest never gets updated with the right authorizations.
$ cordova plugin ls
No plugins added. 'Use cordova plugin add <plugin>'.
$ sudo cordova plugin add "http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git"
{ [Error: ENOENT, no such file or directory '/tmp/plugman-tmp1375200648427/*/plugin.xml']
errno: 34,
code: 'ENOENT',
path: '/tmp/plugman-tmp1375200648427/*/plugin.xml',
syscall: 'open' }
$ cordova plugin ls
[ 'org.apache.cordova.core.media-capture' ]
I was having the same problem with the Connection plugin. Once I changed from "cordova plugin add" to "phonegap local plugin add", it worked fine.
$ phonegap local plugin add http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git
I had the same problem, after some debugging and testing I finally solved the problem:
Open
C:\Users\<user>\AppData\Roaming\npm\node_modules\cordova\node_modules\plugman\src\util\plugins.js.
Find var cmd = util.format('git clone "%s" "%s"', plugin_git_url,
path.basename(tmp_dir)); (line 42 ATM)
Replace it with var cmd = util.format('git clone "%s"
"%s"', plugin_git_url, tmp_dir);.
This will make git clone clone to the absolute tmp path instead of the relative.
I received a similar error. I resolved the issue by removing the media-capture plugin, installing the file plugin, then reinstalling the media-capture plugin
cordova plugin rm org.apache.cordova.media-capture
cordova plugin add org.apache.cordova.file
cordova plugin add org.apache.cordova.media-capture
Maybe media-capture is dependent on the file plugin.
I was also facing the same error :
Suppose if you want to add camera plugin then instead of giving:
cordova plugin add cordova-plugin-camera
use
phonegap plugin add cordova-plugin-camera
and then it will work fine
It turns out i had something really strange with my proxy. Possibly some data compression on the fly which made the data corrupt. Tethering from the phone solved the issue, after completely uninstalling cordova.