linux上的nodejs语法错误,但在Windows上没有

发布于 2025-02-09 22:27:02 字数 762 浏览 1 评论 0 原文

我在nodejs为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);

});

时,它在Windows上运行时可以工作,但是在我的Ubuntu Server上,我在第一行中出现了第一个卷曲括号的语法错误。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凝望流年 2025-02-16 22:27:02

似乎使用对象破坏了您的错误在代码线上。在Nodejs V6中得到了全部支持。如果您正在运行v4.2.6,那将解释为什么它会生成错误。

per 此答案,nodejs v4.1具有命令行参数 -harmony_destructuring < /代码>将启用对象破坏支持的预释放版本。

请记住,Nodejs v4.2.6很旧(6岁),这在本生态系统中被认为是古老的,您也很可能也会遇到其他NPM模块的其他问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文