Errors trying to deploy to phone


#1

Does anyone know why it would be throwing this exception ? I can’t even tell where to begin looking

core.js:1350 ERROR Error: Uncaught (in promise): Error: StaticInjectorError[Router]:
StaticInjectorError[Router]:
NullInjectorError: No provider for Router!
Error: StaticInjectorError[Router]:
StaticInjectorError[Router]:
NullInjectorError: No provider for Router!
at _NullInjector.get (core.js:923)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveNgModuleDep (core.js:10585)
at _callFactory (core.js:10651)
at _createProviderInstance$1 (core.js:10599)
at _NullInjector.get (core.js:923)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveNgModuleDep (core.js:10585)
at _callFactory (core.js:10651)
at _createProviderInstance$1 (core.js:10599)
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at NavControllerBase._fireError (nav-controller-base.js:223)
at NavControllerBase._failed (nav-controller-base.js:216)
at nav-controller-base.js:263
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4629)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3


#2

“No provider for Router!”:


#3

This error is thrown as you can see in the stack trace before the app bootstraps…

I have the following following import:

import { RouterModule, Router } from “@angular/router”;

I’m not even using Router in any of my code so I don’t know where this is coming from…


#4

Are you using Ionic 3 or 4?

If you are not using @angular/router then comment out this line:

// import { RouterModule, Router } from “@angular/router”;

Delete your /node_modules directory and then:

npm install
ionic serve

Then try:

npm run build --prod
npm install http-server -g
http-server ./www