Ionic-native: Cannot find name 'InAppBrowser'

Created on 29 Jan 2019  路  12Comments  路  Source: ionic-team/ionic-native

I'm submitting a ... (check one with "x")
[x] bug report

Current behavior:
After installing the plugin via
ionic cordova plugin add cordova-plugin-inappbrowser and
npm install @ionic-native/in-app-browser

I import the module into the app.module with
import { InAppBrowser } from '@ionic-native/in-app-browser';

However, when adding to the providers array I get the following errors:
Type 'InAppBrowserOriginal' is not assignable to type 'Provider'. Type 'InAppBrowserOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactory

Also, when trying to import directly into a component, I get the following error:
Cannot find name 'InAppBrowser'

If I use InAppBrowserOriginal via imports, I can inject it into a component's constructor without TS linting issues. However, when running with that setup, I get the following error:
Can't resolve all parameters.

Expected behavior:
Per all the docs and anything else I can find, this is the proper way to install and import this package, however, the typescript won't compile.

Steps to reproduce:
See above

Other information:
So far, I have not been successful in finding any other information out there about this issue, which is why I believe I'm doing something wrong, but I'm unable to find it.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Ionic:

   ionic (Ionic CLI)  : 4.8.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 8 other plugins)

System:

   Android SDK Tools : 26.1.1 (/usr/local/share/android-sdk)
   ios-deploy        : 1.9.4
   NodeJS            : v10.15.0 (/usr/local/bin/node)
   npm               : 6.4.1
   OS                : macOS High Sierra
   Xcode             : Xcode 10.0 Build version 10A255

Most helpful comment

I found that if I change the import statement to:
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
It works without issue. Sorry for the trouble!

All 12 comments

I found that if I change the import statement to:
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
It works without issue. Sorry for the trouble!

@adonus19,

Thanks for the solution.

import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; works fine for me too.

I found that if I change the import statement to:
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
It works without issue. Sorry for the trouble!

This doesn't work for me. What I did was close the project and reopen, and it works!

Thanks, ngx worked for me.

Works perfectly!!!! Thanks!!!!

I found that if I change the import statement to:
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
It works without issue. Sorry for the trouble!

It is giving issue in ionic 5. ngx is not found in @ionic-native/in-app-browser/ngx module

Me too. I'm having issues only with the File plugin.

I found that if I change the import statement to:
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
It works without issue. Sorry for the trouble!

It is giving issue in ionic 5. ngx is not found in @ionic-native/in-app-browser/ngx module

Me too. Upgraded to Ionic 5 and got this error code:

Type 'InAppBrowserOriginal' is not assignable to type 'Provider'.
  Type 'InAppBrowserOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)

has anyone found a solution yet? Downgrade to Ionic 4?

import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
added ngx in import statement

Type 'InAppBrowserOriginal' is not assignable to type 'Provider'.
Type 'InAppBrowserOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)

error after upgrading to ionic 5.4.16, cordova 10.0.0.

here is ionic info

`Ionic:

Ionic CLI : 5.4.16 (C:Usersks1162AppDataRoamingnpmnode_modulesionic)
Ionic Framework : @ionic/angular 5.3.1
@angular-devkit/build-angular : 0.901.12
@angular-devkit/schematics : 9.1.12
@angular/cli : 9.1.12
@ionic/angular-toolkit : 2.3.1

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0
Cordova Plugins : no whitelisted plugins (1 plugins total)

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v10.16.3 (C:Program Filesnodejsnode.exe)
npm : 5.6.0
OS : Windows 10`

Same issue, when importing in the module:

(alias) const InAppBrowser: InAppBrowserOriginal
import InAppBrowser
Type 'InAppBrowserOriginal' is not assignable to type 'Provider'.
Type 'InAppBrowserOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)

It causes:

Property 'create' does not exist on type 'InAppBrowser'.ts

When trying to use it.

Ionic CLI : 6.12.3 (C:\Users\Bruno\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 5.5.2
@angular-devkit/build-angular : 0.1100.5
@angular-devkit/schematics : 10.0.8
@angular/cli : 11.0.5
@ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : not installed
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 8 other plugins)

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v14.15.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.8
OS : Windows 10

Still have this issue with "@ionic-native/in-app-browser": "5.30.0".

Type 'InAppBrowserOriginal' is not assignable to type 'Provider'.
Type 'InAppBrowserOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)

Anyone found a solution?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shaliko picture shaliko  路  3Comments

GunaSekhar1 picture GunaSekhar1  路  4Comments

Manduro picture Manduro  路  3Comments

goleary picture goleary  路  3Comments

lycwed picture lycwed  路  4Comments