Home > Mobile >  NodeJS syntax error on linux but not on windows
NodeJS syntax error on linux but not on windows

Time:06-24

I wrote an external task client in nodejs for camunda bpm

const { Client, logger } = require("camunda-external-task-client-js");
const { Variables } = require("camunda-external-task-client-js");

const config = { baseUrl: "http://localhost:8080/engine-rest" };
const client = new Client(config);

client.subscribe("Rechnung", async function({ task, taskService }) {

  console.log("*** Processing task "   task.id);
  
  const processVariables = new Variables();

  await taskService.complete(task, processVariables);

});

It works when i run it on windows but on my ubuntu server i got a syntax error at the first line the first curly bracket.

enter image description here

CodePudding user response:

It appears your error is on a line of code using object destructuring. That received full support in nodejs v6. If you're running v4.2.6, that would explain why it's generating an error.

Per this answer, nodejs v4.1 had a command line argument --harmony_destructuring that would enable a pre-release version of object destructuring support.

Keep in mind that nodejs v4.2.6 is quite old (6 years old) which is considered ancient in this ecosystem and you're likely to run into other problems with other NPM modules too.

  • Related