Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Plugin reference fix #1934

Merged
merged 1 commit into from
Aug 30, 2017
Merged

HTTP Plugin reference fix #1934

merged 1 commit into from
Aug 30, 2017

Conversation

troyanskiy
Copy link
Contributor

Fixes PR #1921 wrong plugin reference

@ihadeed ihadeed merged commit 3a1034e into danielsogl:master Aug 30, 2017
@troyanskiy troyanskiy mentioned this pull request Sep 6, 2017
@flowli
Copy link

flowli commented Sep 7, 2017

@ihadeed Hi there, is this already published via npm? Thanks!

@troyanskiy troyanskiy deleted the http-plugin-ref-fix branch September 7, 2017 09:28
@ihadeed
Copy link
Collaborator

ihadeed commented Sep 7, 2017

@flowli no, it will be published soon. Tonight, or tomorrow.

@DayBr3ak
Copy link

Still not published on npm :(

@troyanskiy
Copy link
Contributor Author

Quick fix to all.

  1. Open your node_modules/@ionic-native/http/index.js
  2. Goto line 297 or search for pluginRef: 'cordovaHTTP',
  3. Replace the line with pluginRef: 'cordova.plugin.http',

@dlmorais-13
Copy link

Another quick fix, but without changing sources at node_modules folder:

Add these two lines in your main.ts file, before boostrapping AppModule.

import { HTTP } from '@ionic-native/http';
HTTP.getPluginRef = () => "cordova.plugin.http";

@yaozuwang
Copy link

I am still getting this error with the reference fix?

@gustavogr
Copy link

I'm still getting the 'plugin_not_installed' error but only in Android. The reference in the wrapper is already fixed. Any clues?

@seliestel
Copy link

Also getting this error, in spite of quick-fixes. Does anybody have an alternative to include native Http requests in ionic3? Thanks.

@elin-y
Copy link

elin-y commented Feb 27, 2018

If you are using the latest versions of ionic native and the cordova plugin, it should already be fixed. Did you try to do a clean install?

# repeat the following command for all platforms
ionic cordova platform rm android
rm -rf node_modules/ platforms/ plugins/ www/
npm install 
# repeat the following command for all platforms
ionic cordova platform add android

@seliestel
Copy link

Thanks a lot for the quick reply, @elin-y. The clean install worked perfectly. Everything fixed now.

@marutifh
Copy link

I am getting a same error even after trying all the solutions available!

Native: tried calling HTTP.setHeader, but the HTTP plugin is not installed.
Install the HTTP plugin: 'ionic cordova plugin add cordova-plugin-advanced-http'

Plugin and node modules versions

cordova-plugin-advanced-http@1.11.0
@ionic-native/core@4.5.3
@ionic-native/http@4.5.3

Even the reference is pointing to the proper plugin.

HTTP = __decorate([ Plugin({ pluginName: 'HTTP', plugin: 'cordova-plugin-advanced-http', pluginRef: 'cordova.plugin.http', repo: 'https://github.com/silkimen/cordova-plugin-advanced-http', platforms: ['Android', 'iOS'] }) ], HTTP); return HTTP;

@diogomgbrito
Copy link

@marutifh did you find a solution?

@marutifh
Copy link

@diogomgbrito With the clean reinstall, its working fine.

@diogomgbrito
Copy link

It worked fine for me as well, turns out the problem was that the http call was made before the platform was ready somehow! Thanks @marutifh :)

@ParikshitSarkar
Copy link

If you are using the latest versions of ionic native and the cordova plugin, it should already be fixed. Did you try to do a clean install?

# repeat the following command for all platforms
ionic cordova platform rm android
rm -rf node_modules/ platforms/ plugins/ www/
npm install 
# repeat the following command for all platforms
ionic cordova platform add android

Thanks a lot, this worked for me. I am not getting "plugin not installed" anymore but now I am getting the following error: "Json error". Any idea how I can get around this? Thanks.

@amrography
Copy link

I had that issue because I was requesting it before this.platform.ready()

@sardapv
Copy link

sardapv commented Aug 18, 2020

thanks man ..i was setting it before ready

put it in then of platform.ready promise return

this.httpNative.setServerTrustMode('nocheck').then((suc) => { console.log('I m in'); }).catch((err) => { console.log(err); }); // tes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.