linux上的nodejs语法错误,但在Windows上没有
我在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上,我在第一行中出现了第一个卷曲括号的语法错误。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎使用对象破坏了您的错误在代码线上。在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.