Can't install inappbrowser plugin


#1
$ ionic cordova plugin add cordova-plugin-inappbrowser
******************************************************
 Dependency warning - for the CLI to run correctly,
 it is highly recommended to install/upgrade the following:

 Please install your Cordova CLI to version  >=4.2.0 `npm install -g cordova`

******************************************************
  _             _
 (_)           (_)
  _  ___  _ __  _  ___
 | |/ _ \| '_ \| |/ __|
 | | (_) | | | | | (__
 |_|\___/|_| |_|_|\___|  CLI v2.2.3

Usage: ionic task args


=======================
cordova is not a valid task


Available tasks:
(use --help or -h for more info)


   start  ..........  Starts a new Ionic project in the specified PATH
   serve  ..........  Start a local development server for app dev/testing
   setup  ..........  Configure the project with a build tool (beta)
   generate  .......  Generate pages and components
   platform  .......  Add platform target for building an Ionic app
   run  ............  Run an Ionic project on a connected device
   emulate  ........  Emulate an Ionic project on a simulator or emulator
   build  ..........  Build (prepare + compile) an Ionic project for a given platform.

   plugin  .........  Add a Cordova plugin
   resources  ......  Automatically create icon and splash screen resources (beta)
                      Put your images in the ./resources directory, named splash or icon.
                      Accepted file types are .png, .ai, and .psd.
                      Icons should be 192x192 px without rounded corners.
                      Splashscreens should be 2208x2208 px, with the image centered in the middle.

   upload  .........  Upload an app to your Ionic account
   share  ..........  Share an app with a client, co-worker, friend, or customer
   lib  ............  Gets Ionic library version or updates the Ionic library
   login  ..........  Login to your Ionic account
   io  .............  Integrate your app with Ionic Cloud services
   security  .......  Store your app's credentials for the Ionic Cloud
   push  ...........  Upload APNS and GCM credentials to Ionic Push
   package  ........  Use Ionic Package to build your app
   config  .........  Set configuration variables for your ionic app
   service  ........  Add an Ionic service package and install any required plugins
   add  ............  Add an Ion, bower component, or addon to the project
   remove  .........  Remove an Ion, bower component, or addon from the project
   list  ...........  List Ions, bower components, or addons in the project
   info  ...........  List information about the users runtime environment
   help  ...........  Provides help for a certain command
   link  ...........  Sets your Ionic App ID for your project
   hooks  ..........  Manage your Ionic Cordova hooks
   state  ..........  Saves or restores state of your Ionic Application using the package.json file
   docs  ...........  Opens up the documentation for Ionic

I install inappbrowser plugin as it on ionic web site. but it gives me an error like this.


#2

What’s your goal here? Install the inAppBrowser for use on cordova app or do you want to use it in the browser?

If it’s the first, you should install cordova’s cli as the error is telling you. You should always install the CLI to run cordova install commands anyways. If you only want to install it for usage in the browser, that wouldn’t make any sense. Just use the regular way of handling url’s in the browser. It’s a mobile app only plugin, if you want to use it just update your cordova.


#3

I want to use it for a mobile application and I update cordova as well

$ npm install -g cordova
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\OSITH\AppData\Roaming\npm\cordova -> C:\Users\OSITH\AppData\Roaming\npm\node_modules\cordova\bin\cordova
C:\Users\OSITH\AppData\Roaming\npm
`-- cordova@7.0.1

But it gives me the same error.


#4

upgrade your ionic cli to latest and rerun your command,
it’ll probably ask you to confirm other cli plugins to download enter Y


#5

what is your node version and npm version ?


#6

$ node -v
v7.9.0

$ npm -v
4.2.0


#7

do you have cordova cli installed, and did you upgrade ionic cli ?, if you have no interest to upgrade ionic cli then just run this command to install the plugin

ionic plugin add cordova-plugin-inappbrowser

#8

$ cordova -v

You have been opted out of telemetry. To change this, run: cordova telemetry on.
7.0.1

I updated the cordova


#9

cool, did you run the command above ?


#10

$ ionic -v
3.1.2
This is the ionic version.

Above command give me this output,

$ ionic plugin add cordova-plugin-inappbrowser
The plugin command has been renamed. To find out more, run:

  ionic cordova plugin --help


#11

Great run this one then

ionic  cordova plugin add cordova-plugin-inappbrowser```

#12

It installed successfully then I follow this code,
Inappbrowser- Code
But when ruunning it gives me this kind of error,

Runtime Error
Uncaught (in promise): Error: No provider for InAppBrowser! Error: No provider for InAppBrowser! at injectionError (http://localhost:8104/build/main.js:1509:86) at noProviderError (http://localhost:8104/build/main.js:1547:12) at ReflectiveInjector_._throwOrNull (http://localhost:8104/build/main.js:3048:19) at ReflectiveInjector_._getByKeyDefault (http://localhost:8104/build/main.js:3087:25) at ReflectiveInjector_._getByKey (http://localhost:8104/build/main.js:3019:25) at ReflectiveInjector_.get (http://localhost:8104/build/main.js:2888:21) at AppModuleInjector.NgModuleInjector.get (http://localhost:8104/build/main.js:3835:52) at resolveDep (http://localhost:8104/build/main.js:11202:45) at createClass (http://localhost:8104/build/main.js:11063:91) at createDirectiveInstance (http://localhost:8104/build/main.js:10899:37)

#13

add the InAppBrowser to the providers in app.module.ts


#14

Thanks a lot it works for me now.