页面正在卸载错误 [英] `the page is being unloaded` error
问题描述
我正在使用NodeJS-ReactJS同构应用程序,当我单击 Link
时,我收到一个错误提示
I was working with a NodeJS-ReactJS Isomorphic App, and when I click on a Link
I'm getting an error saying
未捕获(承诺)错误:请求已终止
可能的原因:网络处于脱机状态,Access-Control-Allow-Origin不允许起源,页面正在卸载等。
我听说的前两个原因(脱机和CORS)。 页面正在卸载
错误是什么意思?
The first two reasons (offline and CORS) I heard about. What is the the page is being unloaded
error means? How it may cause the browser not navigating to need.
推荐答案
您的错误是
Uncaught (in promise) Error: Request has been terminated
此错误是在promise中的请求在解决或拒绝之前终止时引起的。如果(可能原因
)
This error is caused when the request in the promise is terminated before it is resolved or rejected. This can happen if (Possible causes
)
-
网络处于脱机状态
:存在网络故障,与用于处理请求的网址的连接已丢失。 -
Access-Control-Allow-Origin不允许起源
:由于缺少适当的CORS标头,因此请求被拒绝。 / li>
-
正在卸载页面
:发出请求的页面在请求完成之前关闭。
the network is offline
: There is a network failure and the connection to the url using which the request was being processed is lost.Origin is not allowed by Access-Control-Allow-Origin
: The request is rejected due to absence of proper CORS headers.the page is being unloaded
: The page making the request is closed before the request completed.
在上述原因中,与您的案件相关的最可能原因是1或2,因为在单击 Link <时出现错误/ code>导航到组件。请检查正在使用
Link
加载的新组件发出的请求。
Of the above reasons, the most probable cause relevant to your case would be either 1 or 2, since you get the error on clicking a Link
to navigate to a component. Please check the requests being made by the new component that is being loaded using the Link
.
编辑:
如果您查看错误消息的截屏,它清楚地表明该错误发生在行号。在node_modules / superagent / lib / client.js.Request.crossDomainError中的PromiseRequest处的app.js的73194。因此,导致您出错的原因是上面第2条中所述的CORS错误。
If you look at the error message screen shot, it clearly states that the error occured at line no. 73194 of app.js at PromiseRequest in node_modules/superagent/lib/client.js.Request.crossDomainError. So the reason for your error is a CORS error which is described in number 2 above.
这篇关于页面正在卸载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!