Open arnavks97 opened 5 years ago
It's hard to tell without seeing the code, but Trireme is based on a very old version of Node.js, it runs the JavaScript engine (Rhino) set for an older config version, and finally Rhino doesn't support nearly as many ES6 and ES7 features as others. So a lot of recent Node code no longer works with Trireme unfortunately.
On Fri, Apr 19, 2019 at 2:11 AM Arnav Sharma notifications@github.com wrote:
I have a JS program which I want to run through Java for extending it. But, I am getting the following error with scripts referencing JSDOM, but other scripts without JSDOM run fine.
at io.apigee.trireme.core.ScriptFuture.getResult(ScriptFuture.java:82) at io.apigee.trireme.core.ScriptFuture.get(ScriptFuture.java:97) at com.firstTrial.Tester.main(Tester.java:19) Caused by: org.mozilla.javascript.EvaluatorException: missing ; before statement (C:\Users\arsharma\node_modules\jsdom\lib\api.js#21) at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:77) at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:64) at org.mozilla.javascript.Parser.addError(Parser.java:254) at org.mozilla.javascript.Parser.reportError(Parser.java:322) at org.mozilla.javascript.Parser.reportError(Parser.java:309) at org.mozilla.javascript.Parser.reportError(Parser.java:302) at org.mozilla.javascript.Parser.autoInsertSemicolon(Parser.java:1269) at org.mozilla.javascript.Parser.statementHelper(Parser.java:1246) at org.mozilla.javascript.Parser.statement(Parser.java:1103) at org.mozilla.javascript.Parser.parseFunctionBody(Parser.java:740) at org.mozilla.javascript.Parser.function(Parser.java:910) at org.mozilla.javascript.Parser.primaryExpr(Parser.java:3005) at org.mozilla.javascript.Parser.memberExpr(Parser.java:2642) at org.mozilla.javascript.Parser.unaryExpr(Parser.java:2540) at org.mozilla.javascript.Parser.mulExpr(Parser.java:2464) at org.mozilla.javascript.Parser.addExpr(Parser.java:2448) at org.mozilla.javascript.Parser.shiftExpr(Parser.java:2429) at org.mozilla.javascript.Parser.relExpr(Parser.java:2404) at org.mozilla.javascript.Parser.eqExpr(Parser.java:2376) at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:2365) at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:2354) at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:2343) at org.mozilla.javascript.Parser.andExpr(Parser.java:2332) at org.mozilla.javascript.Parser.orExpr(Parser.java:2321) at org.mozilla.javascript.Parser.condExpr(Parser.java:2285) at org.mozilla.javascript.Parser.assignExpr(Parser.java:2248) at org.mozilla.javascript.Parser.expr(Parser.java:2227) at org.mozilla.javascript.Parser.parenExpr(Parser.java:3110) at org.mozilla.javascript.Parser.primaryExpr(Parser.java:3021) at org.mozilla.javascript.Parser.memberExpr(Parser.java:2642) at org.mozilla.javascript.Parser.unaryExpr(Parser.java:2540) at org.mozilla.javascript.Parser.mulExpr(Parser.java:2464) at org.mozilla.javascript.Parser.addExpr(Parser.java:2448) at org.mozilla.javascript.Parser.shiftExpr(Parser.java:2429) at org.mozilla.javascript.Parser.relExpr(Parser.java:2404) at org.mozilla.javascript.Parser.eqExpr(Parser.java:2376) at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:2365) at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:2354) at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:2343) at org.mozilla.javascript.Parser.andExpr(Parser.java:2332) at org.mozilla.javascript.Parser.orExpr(Parser.java:2321) at org.mozilla.javascript.Parser.condExpr(Parser.java:2285) at org.mozilla.javascript.Parser.assignExpr(Parser.java:2248) at org.mozilla.javascript.Parser.expr(Parser.java:2227) at org.mozilla.javascript.Parser.statementHelper(Parser.java:1241) at org.mozilla.javascript.Parser.statement(Parser.java:1103) at org.mozilla.javascript.Parser.parse(Parser.java:642) at org.mozilla.javascript.Parser.parse(Parser.java:577) at org.mozilla.javascript.Context.compileImpl(Context.java:2522) at org.mozilla.javascript.Context.compileString(Context.java:1507) at org.mozilla.javascript.Context.compileString(Context.java:1496) at io.apigee.trireme.core.internal.ScriptUtils.tryCompile(ScriptUtils.java:64) at io.apigee.trireme.core.modules.Evals$NodeScriptImpl.getCompiledScript(Evals.java:231) at io.apigee.trireme.core.modules.Evals$NodeScriptImpl.runScript(Evals.java:217) at io.apigee.trireme.core.modules.Evals$NodeScriptImpl.runInThisContext(Evals.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:387) at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) at io.apigee.trireme.node10.node.module._c_anonymous_18(module.js:439) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at io.apigee.trireme.node10.node.module._c_anonymous_24(module.js:474) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at io.apigee.trireme.node10.node.module._c_anonymous_16(module.js:356) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at io.apigee.trireme.node10.node.module._c_anonymous_14(module.js:312) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at io.apigee.trireme.node10.node.module._c_anonymous_17(module.js:364) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at io.apigee.trireme.node10.node.module._c_require_19(module.js:380) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) at org.mozilla.javascript.gen.CUsers_arsharma_eclipse_workspace_Nashorn_scripts_ALT_altCheck_js_3._c_altAttrCheck_2(C:\Users\arsharma\eclipse-workspace\Nashorn\scripts\ALT\altCheck.js:4) at org.mozilla.javascript.gen.CUsers_arsharma_eclipse_workspace_Nashorn_scripts_ALT_altCheck_js_3.call(C:\Users\arsharma\eclipse-workspace\Nashorn\scripts\ALT\altCheck.js) at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at org.mozilla.javascript.gen.CUsers_arsharma_eclipse_workspace_Nashorn_scripts_mainValidator_js_2._c_allChecks_2(C:\Users\arsharma\eclipse-workspace\Nashorn\scripts\mainValidator.js:14) at org.mozilla.javascript.gen.CUsers_arsharma_eclipse_workspace_Nashorn_scripts_mainValidator_js_2.call(C:\Users\arsharma\eclipse-workspace\Nashorn\scripts\mainValidator.js) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at org.mozilla.javascript.gen.CUsers_arsharma_eclipse_workspace_Nashorn_tester_js_1._c_anonymous_2(C:\Users\arsharma\eclipse-workspace\Nashorn\tester.js:6) at org.mozilla.javascript.gen.C__Users_arsharma_eclipse_workspace_Nashorn_tester_js_1.call(C:\Users\arsharma\eclipse-workspace\Nashorn\tester.js) at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23) at org.mozilla.javascript.gen.CUsers_arsharma_eclipse_workspace_Nashorn_tester_js_1._c_anonymous_1(C:\Users\arsharma\eclipse-workspace\Nashorn\tester.js:1) at org.mozilla.javascript.gen.C__Users_arsharma_eclipse_workspace_Nashorn_tester_js_1.call(C:\Users\arsharma\eclipse-workspace\Nashorn\tester.js) at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2697) at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:287) at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:101) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at io.apigee.trireme.node10.node.module._c_anonymous_18(module.js:456) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at io.apigee.trireme.node10.node.module._c_anonymous_24(module.js:474) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) at io.apigee.trireme.node10.node.module._c_anonymous_16(module.js:356) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at io.apigee.trireme.node10.node.module._c_anonymous_14(module.js:312) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52) at io.apigee.trireme.node10.node.module._c_anonymous_26(module.js:497) at io.apigee.trireme.node10.node.module.call(module.js) at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85) at io.apigee.trireme.node10.main.trireme._c_startup_2(trireme.js:142) at io.apigee.trireme.node10.main.trireme.call(trireme.js) at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74) at io.apigee.trireme.node10.main.trireme._c_anonymous_1(trireme.js:923) at io.apigee.trireme.node10.main.trireme.call(trireme.js) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:402) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3466) at io.apigee.trireme.node10.main.trireme.call(trireme.js) at io.apigee.trireme.core.internal.ScriptRunner.runScript(ScriptRunner.java:762) at io.apigee.trireme.core.internal.ScriptRunner$4.run(ScriptRunner.java:702) at org.mozilla.javascript.Context.call(Context.java:536) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:512) at io.apigee.trireme.core.internal.ScriptRunner.call(ScriptRunner.java:697) at io.apigee.trireme.core.ScriptFuture.run(ScriptFuture.java:183) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)```
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apigee/trireme/issues/190, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD7I2ZULPRUPYCANMMQOMLPRGEE7ANCNFSM4HHC7IYA .
This was caused by async keyword for me - try running trireme with --debug flag to see the exact location of the error
I have a JS program which I want to run through Java for extending it. But, I am getting the following error with scripts referencing JSDOM, but other scripts without JSDOM run fine.