gpt4 book ai didi

angular-universal - 如何修复 "Error at XMLHttpRequest.send angular universal"

转载 作者:行者123 更新时间:2023-12-04 09:45:24 27 4
gpt4 key购买 nike

-编译应用程序后,我多次收到此错误 enter image description here

文本错误:

错误错误

    at XMLHttpRequest.send (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:169324:19)
at Observable.rxjs__WEBPACK_IMPORTED_MODULE_1__.Observable [as _subscribe] (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:19023:17)
at Observable._trySubscribe (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:154852:25)
at Observable.subscribe (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:154838:22)
at DoOperator.call (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:162245:23)
at Observable.subscribe (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:154833:31)
at scheduleTask (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:97108:32)
at Observable.rxjs__WEBPACK_IMPORTED_MODULE_7__.Observable [as _subscribe] (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:97170:13)
at Observable._trySubscribe (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:154852:25)
at Observable.subscribe (C:\Users\seva-\projects\pileuniversal\dist\pileuniversal\server\main.js:154838:22)

创建 ssr 后,我没有在 app.server.module 中导入任何内容localStorage 和 DOM 窗口有问题,但存在隔离

最佳答案

我遇到了同样的问题。你可以看看这篇文章

https://www.infragistics.com/products/ignite-ui-angular/angular/components/general/framework-and-features/ssr-rendering.html

XMLHttpRequest.send 的问题来自于节点服务器不存在此“对象”这一事实。

我建议您跟踪错误的来源。在我的例子中,它来自 ngx-translate 模块,它试图通过 XMLHttpRequest 获取 JSON 文件。要解决此问题,您必须:

  1. 识别从何处调用电话
  2. 应用将正确处理请求的拦截器

就我而言,我遵循本教程:https://itnext.io/angular-universal-how-to-add-multi-language-support-68d83f6dfc4d

我添加了拦截器并解决了问题。

希望对你有帮助

关于angular-universal - 如何修复 "Error at XMLHttpRequest.send angular universal",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62151048/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com