2017-06-14 26 views
4

我有一個完美的Angular應用程序。但是,使用yarn upgrade升級後的依賴性,我得到這個神祕的錯誤:升級後的「Uncaught TypeError:Object.setPrototypeOf調用爲null或undefined」Angular項目

main.bundle.js:6779 Uncaught TypeError: Object.setPrototypeOf called on null or undefined 
    at setPrototypeOf (<anonymous>) 
    at webpackJsonp.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts.__extends (main.bundle.js:6779) 
    at phone-number-input.component.ts:24 
    at Object.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts (phone-number-input.component.ts:69) 
    at __webpack_require__ (bootstrap 8652e46ce92ee05aa5a3:54) 
    at Object.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.module.ts (phone-number-input.component.ts:24) 
    at __webpack_require__ (bootstrap 8652e46ce92ee05aa5a3:54) 
    at Object.../../../../../src/ui-components/src/ui-components.module.ts (roman-numeral.pipe.ts:10) 
    at __webpack_require__ (bootstrap 8652e46ce92ee05aa5a3:54) 
    at Object.../../../../../src/app/app.module.ts (app.component.ts:31) 
webpackJsonp.../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts.__extends @ main.bundle.js:6779 
(anonymous) @ phone-number-input.component.ts:24 
../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.component.ts @ phone-number-input.component.ts:69 
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54 
../../../../../src/ui-components/src/components/phone-number-input/phone-number-input.module.ts @ phone-number-input.component.ts:24 
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54 
../../../../../src/ui-components/src/ui-components.module.ts @ roman-numeral.pipe.ts:10 
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54 
../../../../../src/app/app.module.ts @ app.component.ts:31 
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54 
../../../../../src/main.ts @ environment.ts:10 
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54 
2 @ ui-components.module.ts:108 
__webpack_require__ @ bootstrap 8652e46ce92ee05aa5a3:54 
webpackJsonpCallback @ bootstrap 8652e46ce92ee05aa5a3:25 
(anonymous) @ main.bundle.js:1 

在以下指定的文件和行號我找不到任何問題。 IDE顯示沒有問題,並且編譯沒有錯誤。

當試圖註釋掉錯誤中提到的組件時,它只是開始提及另一個組件。

什麼可能導致這種情況,我該如何調試/調查這個神祕的錯誤?

回答

11

沒有任何有意義的錯誤消息和堆棧跟蹤幾乎沒有告訴我。我決定調查究竟是什麼觸發了這個問題。考慮到它出現在依賴升級後,我已經拉起差異yarn.lock,並開始回覆它的一些部分,並重新編譯應用程序,檢查它是否會使錯誤消失。經過一番繁瑣的工作後,我發現它是由TypeScript從2.3.4更新爲2.4.0而引起的。

因此,下一步將研究the changelog並分析我的代碼中可能會破壞的內容。

因此,最後我會建議您更頻繁地升級您的依賴項(這將有助於在您需要調查時減少升級大小)。

我希望它能幫助別人。乾杯!

更新

  • 經過進一步調查,我發現了這個時候發生錯誤的確切情況,所以我posted an issue到角GitHub的倉庫。

  • 最後,這裏是TypeScript中的actual culprit issue

+0

確實有幫助!謝謝,斯拉瓦:) – DanielM

+1

希望我能多勞多得。從字面上挽救了我的一天。非常感謝 ! – Mozgor

+0

拯救生命。 「Nuff說。 – Carcamano