静态解析符号值时遇到错误。调用函数 'SimpleNotificationsModule'

Error encountered resolving symbol values statically. Calling function 'SimpleNotificationsModule'

我已经在我的 Angular 4 项目中安装了 angular2-notifications 并且一切正常,但是当我更换机器时,我在尝试使用 ng serve 进行编译时遇到了以下问题:

ERROR in Error: Error encountered resolving symbol values statically. Calling function 'SimpleNotificationsModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in myapp/src/app/app.module.ts, resolving symbol AppModule in myapp/src/app/app.module.ts

阅读了一些有关 similar issues on github 的内容后,我终于找到了解决方案:

出于某种原因 IntelliJ/Webstorm 倾向于将此包导入为:

import { SimpleNotificationsModule } from 'angular2-notifications/dist';

应该改为:

import { SimpleNotificationsModule } from 'angular2-notifications';

感谢 MattsSe 在 GitHub.

上发布此解决方案