无法在firebase中构建应用程序

时间:2017-04-15 17:05:42

标签: javascript angularjs firebase

您好我最近开始使用firebase并遇到一个问题。

我正在构建小型Web应用程序,我已将此Web应用程序连接到firebase后端以读取和写入数据库。 一切都很好,我有联系。我可以将项目放到数据库中并通过GET请求获取它们。我已经实现了简单的身份验证,并且工作得很好。 突然,今天我的应用程序在终端窗口中的'ng serve'命令后停止构建。我收到一个错误:

ERROR in ./~/firebase/app/shared_promise.js
Module not found: Error: Can't resolve 'promise-polyfill' in '/Users/me/Desktop/GMO/node_modules/firebase/app'
 @ ./~/firebase/app/shared_promise.js 22:35-62
 @ ./~/firebase/app/firebase_app.js
 @ ./~/firebase/app.js
 @ ./~/firebase/firebase-browser.js
 @ ./src/app/auth/auth.service.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

我确信我没有更改firebase模块内的任何内容。

在此内容./~/firebase/app/shared_promise.js

那里有一条线:

var PromiseImpl = scope.Promise || require('promise-polyfill');

并且我发现如果我从中删除“|| require('promise-polyfill')”,该应用程序可以正常工作。当然我不想这样做,因为这是模块的元素,我不想改变它,但我没有任何其他想法......

请指教!

1 个答案:

答案 0 :(得分:4)

@Andrew,您的解决方案正在运作:

npm install promise-polyfill --save-exact