Jering.Javascript.NodeJS JsCompilationException on spawn identifier
soroshsabz opened this issue · 1 comments
soroshsabz commented
ITNOA
Hi
I have a GitHub project https://github.com/soroshsabz/visualstudio-ansible and in Ansible.VisualStudio.LanguagerServer vs project, I have SpawnServer.js file that content like below
const { spawn } = require("child_process");
spawn("npx", ["ansible-language-server"].concat(process.argv[2]), { stdio: 'inherit' });
When I want to run this script from C# code I got JsCompilationException withe below details
Exception thrown: 'JavaScriptEngineSwitcher.Core.JsCompilationException' in JavaScriptEngineSwitcher.Node.dll
An unhandled exception of type 'JavaScriptEngineSwitcher.Core.JsCompilationException' occurred in JavaScriptEngineSwitcher.Node.dll
SyntaxError: Identifier 'spawn' has already been declared
at SpawnServer.js:1:1 -> // ITNOA
My loading code like below
using JavaScriptEngineSwitcher.Core;
using JavaScriptEngineSwitcher.Jurassic;
using JavaScriptEngineSwitcher.Node;
using System;
namespace Ansible.VisualStudio.LanguageServer
{
public class Loader
{
public Loader()
{
IJsEngine engine = new NodeJsEngine();
engine.ExecuteFile("SpawnServer.js");
}
}
}
Where is my wrong?
if you want to see my code in GitHub you can see language-server branch
I create same Question in SO
thanks
soroshsabz commented
related to JeringTech/Javascript.NodeJS#139 I close this issue