franmcod
franmcod

Reputation: 497

React Component not found

I'm making a React app on asp.net core. I'm using the ReactJS.NET library and webpack as my bundler and transpiler of the jsx components.

I have it working locally, but when i deplloy to azure, i get this log:

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()

From ReactJS.NET Docs, "From version 2.2 onwards ReactJS.NET works out of the box in Azure using the V8 JavaScript engine". And it says ".SetAllowMsieEngine(false); on app.UseReact()", but this is now deprecated...

Not sure what to do :/ Thanks in advance

Upvotes: 1

Views: 1011

Answers (1)

franmcod
franmcod

Reputation: 497

After alot of trying, i got it working. Found a github post https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/Registration-of-JS-engines

Installed the packages in the Core section, and added the code to the startup.cs it worked after deploying to azure. The V8 package and jurassic don't work on Core.

Upvotes: 1

Related Questions