Build using ng serve or ng build: OK
Console Error:
app.module.ts
Uncaught TypeError: Cannot read property 'forRoot' of undefined at app.module.ts
The only other module I import is ToastModule. I tested without it and the error still occurs.
ng --version
angular-cli: 1.0.0-beta.24
node: 7.2.1
os: win32 x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.5
npm install --save ng2-bootstrap bootstrap
...
import { ToastModule } from 'ng2-toastr/ng2-toastr';
import { AlertModule } from 'ng2-bootstrap';
...
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
ToastModule,
AlertModule.forRoot(),
// Routing
RouterModule.forRoot(ROUTES, { useHash: false, preloadingStrategy: PreloadAllModules })
],
providers: [ ],
bootstrap: [AppComponent]
I am facing the same exact problem.
I am facing this problem as well. Any suggestions?
Same problem here.
Reverting to fixed version 1.2.6 solved the issue for us.
+1
Thanks LeGonidec.
+1
Same problem here.
Reverting to fixed version 1.2.6 solved the issue for us.
Solved an old version
npm install [email protected] --save
I have the same issue
Uncaught TypeError: Cannot read property 'forRoot' of undefined
at app.module.ts:66
at Object.<anonymous> (app.module.ts:89)
at __webpack_require__ (bootstrap ecbca6e…:52)
at Object.<anonymous> (src async:23)
at __webpack_require__ (bootstrap ecbca6e…:52)
at Object.<anonymous> (.*$:20)
at __webpack_require__ (bootstrap ecbca6e…:52)
at webpackJsonpCallback (bootstrap ecbca6e…:23)
at main.bundle.js:1
importing all module from root 'ng2-bootstrap' import { ModalModule, PaginationModule, TypeaheadModule } from 'ng2-bootstrap';
Reverting to version 1.2.6 solved the issue.
Result of ng version:
angular-cli: 1.0.0-beta.24
node: 7.4.0
os: win32 x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.5
@angular/language-service: 2.4.5
Upgrading to angular-cli latest (1.0.0-beta.26) fixes this issue
I run angular-cli beta 26 and I get the same issue as described above.
Not really, beta.26 doesn't fix it for me either
I'm already on beta.26. It doesn't fix the issue.
I have an idea, let me try
I don't know if it's related to this issue or not but when I upgrade my project to angular-cli beta.26 I has the same issue with another module from my project (shared module).
I'll try to investigate on my project to know why my shared module is undefined.
Please try v1.3.2 and drop me a note
The issue seems to be solved by this release.
Thanks, for update :)
Most helpful comment
Solved an old version
npm install [email protected] --save