We are using Sitecore JSS running against Sitecore 9.2 in containers. The containers are built from https://github.com/Sitecore/docker-images with only minor changes (adding Unicorn, App Insights etc). We've had the starter app running fine in a separate but similar scenario, and we are now building our own app.
When I start the containers I can see the 'Welcome to Sitecore' page with the woman on the phone and login and use the Experience editor and the Content editor just fine. However, when I try to view the JSS app I get the following error:
Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: Item has already been added. Key in dictionary: 'PSMODULEPATH' Key being added: 'PSModulePath'
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables()
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.OutOfProcessNodeInstance.PrepareNodeProcessStartInfo(String entryPointFilename, String projectPath, String commandLineArguments, IDictionary`2 environmentVars, Boolean launchWithDebugging, Int32 debuggingPort)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.OutOfProcessNodeInstance..ctor(String entryPointScript, String projectPath, String[] watchFileExtensions, String commandLineArguments, ILogger nodeOutputLogger, IDictionary`2 environmentVars, Int32 invocationTimeoutMilliseconds, Boolean launchWithDebugging, Int32 debuggingPort, String nodePath)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.HostingModels.Http.HttpNodeInstance..ctor(NodeServicesOptions options, Int32 port)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.NodeServicesOptions.<.ctor>b__3_0()
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.DefaultNodeServices.GetOrCreateCurrentNodeInstance()
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.DefaultNodeServices.InvokeExportWithPossibleRetry[T](String moduleName, String exportedFunctionName, Object[] args, Boolean allowRetry)
at Sitecore.JavaScriptServices.ViewEngine.NodeServices.DefaultNodeServices.InvokeExport[T](String moduleName, String exportedFunctionName, Object[] args)
at Sitecore.JavaScriptServices.ViewEngine.Node.NodeRenderEngine.Invoke[T](String moduleName, String functionName, Object[] functionArgs)
at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.PerformRender(TextWriter writer, IRenderEngine renderEngine, String moduleName, String functionName, Object[] functionArgs)
at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
This happens on CM and CD, whether logged out or logged in, Experience editor or not. The home page of the JSS app that I'm trying to view is very simple at the moment, just a few components, and removing those doesn't help.
In PowerShell I can see that the PsModulePath
environment variable exists, but just once. I tried unsetting it as an experiment but that didn't help.
App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.ViewEngine.Node.config
does not contain any reference to PSModulePath
.
It may be that the PSModulePath
key is not important, and it is simply trying to load all environment variables twice.
Any suggestions?