Issue importing Package
I have been running into an issue when I install angular2-flash-messages. Several devs had this issue so I took a look. When we follow the instructions on the readme, and run ng serve we get:
ERROR in src/app/app.module.ts(3,24): error TS2307: Cannot find module 'angular2-flash-messages'.
src/app/app.module.ts(14,5): error TS2304: Cannot find name 'FlashMessagesModule'.
Same in the IDEs. It seems like the exporting module may be missing or the readme may be out of date. I was able to get them going by importing from the files directly for now ie:
import { FlashMessagesModule } from 'angular2-flash-messages/module/module.js'; and
import { FlashMessagesService } from 'angular2-flash-messages/module/flash-messages.service.js';
Lucky for us, these are just projects for personal use so this implementation is fine, but I just wanted to give you folks a heads up that there may be an issue somewhere.
Dependencies if helpful, rest of package.json is just standard ng cli output:
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"angular2-flash-messages": "^2.0.1",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.5.2",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"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.7.0",
"typescript": "~2.4.2"
}
I've been running into this same issue.
here the same issue
@rudenate3 I've just pushed new version of the package to NPM - update and let me know if it works properly. Thanks!
@Moff Awesome, that did fix the import for the main module in app.module.ts but import { FlashMessagesService } from 'angular2-flash-messages' is still throwing the error 'Module <my-project>/node_modules/angular2-flash-messages/module/module' has no exported member 'FlashMessagesService'
@rudenate3 update the package one more time please
@moff That got it! Thank you!
@rudenate3 thank you for your feedback!
Thank you for the great package and fast response :)