moff / angular2-flash-messages

Angular 2 flash messages module
52 stars 21 forks source link

Cannot find module angular2-flash-messages #18

Closed ATakaSKY closed 7 years ago

ATakaSKY commented 7 years ago

I am trying to use angular2-flash-messages but getting Cannot find module angular2-flash-messages.

Followed installation steps from https://github.com/moff/angular2-flash-messages.

Attaching my app.module.ts-


import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import {RouterModule, Routes} from '@angular/router';
import { AngularFireModule, AuthProviders, AuthMethods} from 'angularfire2';
import {FirebaseService} from './services/firebase.service';
import {FlashMessagesModule} from 'angular2-flash-messages';

import { AppComponent } from './app.component';
import { HomeComponent } from './components/home/home.component';
import { ListingsComponent } from './components/listings/listings.component';
import { NavbarComponent } from './components/navbar/navbar.component';
import { ListingComponent } from './components/listing/listing.component';
import { AddListingComponent } from './components/add-listing/add-listing.component';
import { EditListingComponent } from './components/edit-listing/edit-listing.component';

const appRoutes: Routes = [
  {path:'', component:HomeComponent},
  {path: 'listings', component:ListingsComponent},
  {path:'listing/:id', component:ListingComponent},
  {path: 'add-listing', component:AddListingComponent}
]

@NgModule({
  declarations: [
    AppComponent,
    HomeComponent,
    ListingsComponent,
    NavbarComponent,
    ListingComponent,
    AddListingComponent,
    EditListingComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    FlashMessagesModule,
    RouterModule.forRoot(appRoutes)
  ],
  providers: [FirebaseService],
  bootstrap: [AppComponent]
})
export class AppModule { }

And here'e the error:

ERROR in C:/Users/user/Downloads/Compressed/proplistings_part_4/src/app/components/navbar/navbar.component.ts (3,36): Cannot find module 'angular2-fla
sh-messages'.

ERROR in C:/Users/user/Downloads/Compressed/proplistings_part_4/src/app/app.module.ts (8,35): Cannot find module 'angular2-flash-messages'.

ERROR in C:/Users/user/Downloads/Compressed/proplistings_part_4/src/app/app.module.ts (8,35): Cannot find module 'angular2-flash-messages'.

Can someone help here.

moff commented 7 years ago

@ATakaSKY do you use SystemJS?

tuanrobe1989 commented 7 years ago

The same error watting you reply.

tariq-mahmood-dev commented 7 years ago

I was having the same issue, after fresh installation and I found that

index.d.ts is missing in new installs, just create the file in node_modules/angular2-flash-messages and add export * from './module/index';

GabrielAmazonas commented 7 years ago

Your import should be like this: import {FlashMessagesModule} from 'angular2-flash-messages/module';

ATakaSKY commented 7 years ago

Thanks everyone for replying. Particularly @GabrielAmazonas, thanks man. Got it working now. But their documentation still show its import without the /module. Any views on that.

moff commented 7 years ago

Hello, @ATakaSKY , I've updated the package - install new version and let me know how it goes now. Check SystemJS config guide in readme.md, if you use it.

moff commented 7 years ago

@ATakaSKY, @tuanrobe1989 do you still experience the same issue using latest package version?

rjankathi commented 6 years ago

@moff : It still hs problem Cannot build the angular project. image

on version angular 5 , FlashMessages Latest version

Raj

moff commented 6 years ago

@rjankathi please post here contents of your package.json and tsconfig.json files

rjankathi commented 6 years ago

@moff: Please find the below screen shots tsconfig.json image package.json image

rjankathi commented 6 years ago

changed back to ng Version 4 as well (in the above) No luck :(

clevadani commented 6 years ago

I'm still having this issue. And none of the solutions outlined above have worked for me.

jammey007 commented 6 years ago

ANYONE HAVE A SOLUTION TO FIX THIS ERRORS: ERROR in src/app/app.module.ts(5,35): error TS2307: Cannot find module 'angular2-flash-messages/module'. src/app/app.module.ts(7,35): error TS2307: Cannot find module 'angularfire2'. src/app/app.module.ts(8,37): error TS2307: Cannot find module 'angularfire2/database'. src/app/app.module.ts(9,33): error TS2307: Cannot find module 'angularfire2/auth'. src/app/components/add-client/add-client.component.ts(2,38): error TS2307: Cannot find module 'angular2-flash-messages'. src/app/components/client-details/client-details.component.ts(3,38): error TS2307: Cannot find module 'angular2-flash-messages'. src/app/components/edit-client/edit-client.component.ts(3,38): error TS2307: Cannot find module 'angular2-flash-messages'. src/app/components/login/login.component.ts(2,38): error TS2307: Cannot find module 'angular2-flash-messages'. src/app/components/navbar/navbar.component.ts(2,38): error TS2307: Cannot find module 'angular2-flash-messages'. src/app/components/register/register.component.ts(2,38): error TS2307: Cannot find module 'angular2-flash-messages'. src/app/components/settings/settings.component.ts(4,38): error TS2307: Cannot find module 'angular2-flash-messages'. src/app/guards/auth.guard.ts(4,33): error TS2307: Cannot find module 'angularfire2/auth'. src/app/services/auth.service.ts(2,33): error TS2307: Cannot find module 'angularfire2/auth'. src/app/services/client.service.ts(2,87): error TS2307: Cannot find module 'angularfire2/database'.

kestrel97 commented 5 years ago

'angular2-flash-messages/module' This also doesn't working along with 'angular2-flash-messages'(a/c to official documentation)

hightechtony commented 5 years ago

npm install angular2-flash-messages --save