2017-08-09 53 views
1

我有一個奇怪的問題react-stripe-elements。該模塊與未被捕獲的錯誤內容如下崩潰:react-stripe-elements沒有檢測到Stripe.js

Uncaught Error: Please load Stripe.js (https://js.stripe.com/v3/) on this page to use react-stripe-elements. 
    at new Provider (Provider.js:38) 
    at ReactCompositeComponent.js:294 
    at measureLifeCyclePerf (ReactCompositeComponent.js:75) 
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (ReactCompositeComponent.js:293) 
    at ReactCompositeComponentWrapper._constructComponent (ReactCompositeComponent.js:279) 
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:187) 
    at Object.mountComponent (ReactReconciler.js:45) 
    at ReactDOMComponent.mountChildren (ReactMultiChild.js:236) 
    at ReactDOMComponent._createInitialChildren (ReactDOMComponent.js:703) 
    at ReactDOMComponent.mountComponent (ReactDOMComponent.js:522) 
    at Object.mountComponent (ReactReconciler.js:45) 
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:370) 
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:257) 
    at Object.mountComponent (ReactReconciler.js:45) 
    at ReactDOMComponent.mountChildren (ReactMultiChild.js:236) 
    at ReactDOMComponent._createInitialChildren (ReactDOMComponent.js:703) 
    at ReactDOMComponent.mountComponent (ReactDOMComponent.js:522) 
    at Object.mountComponent (ReactReconciler.js:45) 
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:370) 
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:257) 
    at Object.mountComponent (ReactReconciler.js:45) 
    at Object.updateChildren (ReactChildReconciler.js:121) 
    at ReactDOMComponent._reconcilerUpdateChildren (ReactMultiChild.js:206) 
    at ReactDOMComponent._updateChildren (ReactMultiChild.js:310) 
    at ReactDOMComponent.updateChildren (ReactMultiChild.js:297) 
    at ReactDOMComponent._updateDOMChildren (ReactDOMComponent.js:942) 
    at ReactDOMComponent.updateComponent (ReactDOMComponent.js:760) 
    at ReactDOMComponent.receiveComponent (ReactDOMComponent.js:722) 
    at Object.receiveComponent (ReactReconciler.js:124) 
    at ReactCompositeComponentWrapper._updateRenderedComponent (ReactCompositeComponent.js:753) 
    at ReactCompositeComponentWrapper._performComponentUpdate (ReactCompositeComponent.js:723) 
    at ReactCompositeComponentWrapper.updateComponent (ReactCompositeComponent.js:644) 
    at ReactCompositeComponentWrapper.receiveComponent (ReactCompositeComponent.js:546) 
    at Object.receiveComponent (ReactReconciler.js:124) 
    at Object.updateChildren (ReactChildReconciler.js:109) 
    at ReactDOMComponent._reconcilerUpdateChildren (ReactMultiChild.js:206) 
    at ReactDOMComponent._updateChildren (ReactMultiChild.js:310) 
    at ReactDOMComponent.updateChildren (ReactMultiChild.js:297) 
    at ReactDOMComponent._updateDOMChildren (ReactDOMComponent.js:942) 
    at ReactDOMComponent.updateComponent (ReactDOMComponent.js:760) 
    at ReactDOMComponent.receiveComponent (ReactDOMComponent.js:722) 
    at Object.receiveComponent (ReactReconciler.js:124) 
    at Object.updateChildren (ReactChildReconciler.js:109) 
    at ReactDOMComponent._reconcilerUpdateChildren (ReactMultiChild.js:206) 
    at ReactDOMComponent._updateChildren (ReactMultiChild.js:310) 
    at ReactDOMComponent.updateChildren (ReactMultiChild.js:297) 
    at ReactDOMComponent._updateDOMChildren (ReactDOMComponent.js:942) 
    at ReactDOMComponent.updateComponent (ReactDOMComponent.js:760) 
    at ReactDOMComponent.receiveComponent (ReactDOMComponent.js:722) 
    at Object.receiveComponent (ReactReconciler.js:124) 

模塊似乎認爲Stripe.js未加載。不過,我已確認以下是在<head>

<script src="https://js.stripe.com/v3/"></script> 

這與條紋here提供的說明一致。

如果我刷新頁面,它會正常加載而不會引發錯誤!

這種情況看起來很簡單,我甚至不確定需要通過什麼途徑來調試它。條紋js應該存在,並且它是,但它不被檢測到。有沒有人遇到這個問題或有任何想法如何處理它?

回答

2

如果有人遇到類似的行爲,這個問題是由於互聯網連接不穩定造成的。事實證明,與條帶的連接比其他任何連接更不穩定,並且stripe.js庫沒有正確下載。這就是爲什麼它要我去Please load stripe.js

+0

任何解決方案或只是一個生活的事實? –

+0

解決的辦法是穩定我的網絡連接。 – melchoir55

+0

我想你必須尋找錯誤,並抓住它,所以應用程序不會崩潰?或者你只是希望它從來沒有發生過真正的用戶? –