gpt4 book ai didi

azure - 未找到 react 组件

转载 作者:行者123 更新时间:2023-12-03 03:06:19 24 4
gpt4 key购买 nike

我正在 asp.net core 上制作一个 React 应用程序。我使用 ReactJS.NET 库和 webpack 作为 jsx 组件的 bundler 和转译器。

我让它在本地工作,但是当我部署到azure时,我得到这个日志:

An unhandled exception occurred while processing the request.

ReactEngineNotFoundException: No usable JavaScript engine was found. Please
install a JavaScript engine such as React.JavaScriptEngine.ClearScriptV8 (on
Windows) or React.JavaScriptEngine.VroomJs (on Linux and Mac OS X). Refer to
the ReactJS.NET documentation for more details.
React.AspNet.HtmlHelperExtensions.get_Environment()

TinyIoCResolutionException: Unable to resolve type:
React.JavaScriptEngineFactory
React.AspNet.HtmlHelperExtensions.get_Environment()

TinyIoCResolutionException: Unable to resolve type: React.ReactEnvironment
React.AspNet.HtmlHelperExtensions.get_Environment()

ReactNotInitialisedException: ReactJS.NET has not been initialised correctly.
Please ensure you have called app.AddReact() and app.UseReact() in your
Startup.cs file.
React.AspNet.HtmlHelperExtensions.get_Environment()

来自 ReactJS.NET 文档,“从版本 2.2 开始,ReactJS.NET 使用 V8 JavaScript 引擎在 Azure 中开箱即用”。它说“.SetAllowMsieEngine(false); on app.UseReact()”,但现在已弃用......

不知道该怎么办:/提前致谢

最佳答案

经过多次尝试,终于成功了。找到了github帖子https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/Registration-of-JS-engines

在Core部分安装了软件包,并将代码添加到部署到azure后起作用的startup.cs中。 V8 软件包和 jurassic 不适用于 Core。

关于azure - 未找到 react 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44190968/

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