【问题标题】:React Component not found未找到反应组件
【发布时间】:2017-05-25 22:50:17
【问题描述】:

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

我让它在本地工作,但是当我部署到 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 Docs,“从 2.2 版开始,ReactJS.NET 使用 V8 JavaScript 引擎在 Azure 中开箱即用”。它说“.SetAllowMsieEngine(false); on app.UseReact()”,但现在已弃用...

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

【问题讨论】:

    标签: azure asp.net-core reactjs.net


    【解决方案1】:

    经过大量尝试,我得到了它的工作。找到了一个github帖子https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/Registration-of-JS-engines

    在Core部分安装包,并将代码添加到startup.cs,部署到azure后就可以工作了。 V8 包和侏罗纪不适用于 Core。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-27
      • 1970-01-01
      • 2016-05-27
      • 2018-05-03
      • 2023-04-02
      • 1970-01-01
      • 2019-03-11
      • 2017-11-25
      相关资源
      最近更新 更多