No provider for Vibration!


#1

I am trying to use the native Ionic plugin Vibration, but I get this error when executing the app:

Error: No provider for Vibration!
    at NoProviderError.BaseError [as constructor] (main.js:8200)
    at NoProviderError.AbstractProviderError [as constructor] (main.js:56183)
    at new NoProviderError (main.js:56214)
    at ReflectiveInjector_._throwOrNull (main.js:107800)
    at ReflectiveInjector_._getByKeyDefault (main.js:107828)
    at ReflectiveInjector_._getByKey (main.js:107791)
    at ReflectiveInjector_.get (main.js:107600)
    at AppModuleInjector.NgModuleInjector.get (main.js:56885)
    at CompiledTemplate.proxyViewClass.AppView.injectorGet (main.js:108342)
    at CompiledTemplate.proxyViewClass.DebugAppView.injectorGet (main.js:108584)
ErrorHandler.handleError @ main.js:56472

Note: when I run npm install --save @ionic-native/vibration, I get the following:

Complete output

Any idea of how to fix this?

By the way, I don’t understand how a dependency can be both extraneous and causing an error because unmet.


#2

Did you import Vibration in your app module?


#3

Did you remember to add Vibration to the providers list of your app module?


#4

No, just in my .ts file where I use it.
How to add it to the app module?


#5

The rest of the documentation is great too.


#6

Thanks a lot, I don’t know how I could miss this part of the documentation!