question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No provider for Router! Angular CLI 1.3.2

See original GitHub issue

I have just created a new empty project using the current Angular CLI (1.3.2) and the current angular-application-insights (2.3.1) and get a “No provider for Router!” error.

zone.js:661 Unhandled Promise rejection: No provider for Router! ; Zone: <root> ; Task: Promise.then ; Value: Error: No provider for Router!
    at injectionError (core.es5.js:1169)
    at noProviderError (core.es5.js:1207)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (core.es5.js:2649)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKeyDefault (core.es5.js:2688)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKey (core.es5.js:2620)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_.get (core.es5.js:2489)
    at resolveNgModuleDep (core.es5.js:9481)
    at _createClass (core.es5.js:9524)
    at _createProviderInstance$1 (core.es5.js:9492)
    at initNgModule (core.es5.js:9446) Error: No provider for Router!
    at injectionError (http://localhost:4200/vendor.bundle.js:47653:90)
    at noProviderError (http://localhost:4200/vendor.bundle.js:47691:12)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (http://localhost:4200/vendor.bundle.js:49133:19)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKeyDefault (http://localhost:4200/vendor.bundle.js:49172:25)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKey (http://localhost:4200/vendor.bundle.js:49104:25)
    at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_.get (http://localhost:4200/vendor.bundle.js:48973:21)
    at resolveNgModuleDep (http://localhost:4200/vendor.bundle.js:55965:25)
    at _createClass (http://localhost:4200/vendor.bundle.js:56008:65)
    at _createProviderInstance$1 (http://localhost:4200/vendor.bundle.js:55976:26)
    at initNgModule (http://localhost:4200/vendor.bundle.js:55930:13)

npm list --depth=0

+-- @angular/animations@4.3.6
+-- @angular/cli@1.3.2
+-- @angular/common@4.3.6
+-- @angular/compiler@4.3.6
+-- @angular/compiler-cli@4.3.6
+-- @angular/core@4.3.6
+-- @angular/forms@4.3.6
+-- @angular/http@4.3.6
+-- @angular/language-service@4.3.6
+-- @angular/platform-browser@4.3.6
+-- @angular/platform-browser-dynamic@4.3.6
+-- @angular/router@4.3.6
+-- @markpieszak/ng-application-insights@2.3.1
+-- @types/jasmine@2.5.54
+-- @types/jasminewd2@2.0.3
+-- @types/node@6.0.88
+-- codelyzer@3.1.2
+-- core-js@2.5.1
+-- jasmine-core@2.6.4
+-- jasmine-spec-reporter@4.1.1
+-- karma@1.7.1
+-- karma-chrome-launcher@2.1.1
+-- karma-cli@1.0.1
+-- karma-coverage-istanbul-reporter@1.3.0
+-- karma-jasmine@1.1.0
+-- karma-jasmine-html-reporter@0.2.2
+-- protractor@5.1.2
+-- rxjs@5.4.3
+-- ts-node@3.2.2
+-- tslint@5.3.2
+-- typescript@2.3.4
`-- zone.js@0.8.17

package.json

{
  "name": "ngcli",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "@markpieszak/ng-application-insights": "^2.3.1",
    "core-js": "^2.4.1",
    "rxjs": "^5.4.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.3.2",
    "@angular/compiler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.1.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
MarkPieszakcommented, Sep 13, 2017

Published 2.3.4 and tried, the types dep error is gone, and I didn’t see “No provider for Router” so I think we’re all set now!

1reaction
ghostcommented, Sep 10, 2017

It seems like I have been getting this error in my bare bones project as I simply followed the minimal instructions for setting up and had not added any routes. Everything is fine after adding some routes and more importantly the dependency on the RouterModule. The latest version is missing the typings dependency for applicationinsights from my previous comment.

Thanks for your help

Chris

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: No provider for t - angular - Stack Overflow
You are trying to use a service that is not listed in providers of your AppModule. Add the service to a providers list...
Read more >
No provider for Store! angular 2.3.x, 2.4.0 and 2.4.1 #307
I cloned it, just run it, all good. Mine presents the issue with AOT, since upgrading to angular 2.3.x 2.4.x. I don't use...
Read more >
Add navigation with routing - Angular
First, the app-routing.module.ts file imports RouterModule and Routes so the application can have routing capability. The next import, HeroesComponent , gives ...
Read more >
48 answers on StackOverflow to the most popular Angular ...
I am getting the EXCEPTION: No provider for Http! in my Angular app. What am I doing wrong? import {Http, Headers} from 'angular2/http';...
Read more >
Angular Authentication with OpenID Connect and Okta in 20 ...
If you haven't used the Angular CLI to quickly generate Angular code, you're in for a ... NullInjectorError: No provider for HttpClient!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found