← Back Home

Fixing Angular Unknown Provider $$asyncCallbackProvider

While trying to upgrade from Angular 1.5 to 1.8 on a legacy system, I encountered a strange error in our tests.

Error: [$injector:modulerr] Failed to instantiate module ngMock due to:
Error: [$injector:unpr] Unknown provider: $$asyncCallbackProvider

The fix is fairly straightforward: we just need to keep the angular version and the angular-mocks version in sync i.e. both the packages should use the same version. After that, a quick yarn install and voila!