2017-04-15 16 views
1

您好,我最近開始使用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'); 

,我發現,如果我刪除「||要求(「許諾, polyfill')「,它的作品。當然,我不想這樣做,因爲這是模塊的元素,我不想改變它,但我沒有任何其他想法...

請指教!

+0

你嘗試'NPM安裝的承諾,polyfill'和'NPM install'在你的項目的根文件夾? – user886

+0

@Andrew這個作品很有魅力!謝謝!昨天幾乎花了整整一天的時間... – Maciejjy

回答

4

@Andrew,您的解決方案的工作:

npm install promise-polyfill --save-exact 
+2

如果有人想知道,'--save-exact'將阻止更新到promise-polyfill的新版本(阻止它們破壞現有的firebase代碼)。 – user886

相關問題