【问题标题】:JS SyntaxError: Unexpected reserved wordJS SyntaxError:意外的保留字
【发布时间】:2022-06-10 23:58:08
【问题描述】:

您好,我目前正在做一个项目,我有这两个:

async function getCoinQuote(inputMint, outputMint, amount) {
let res = got
    .get(
        `https://quote-api.jup.ag/v1/quote?outputMint=${outputMint}&inputMint=${inputMint}&amount=${amount}&slippage=${SLIPPAGE}`
    )
    .json();
return res;
}

//In my main 
const buyRoute = await getCoinQuote(
        QUOTE_MINT,
        ASSET_MINT,
        initial
    ).then((res) => {
        return res.data[0];
    });

我不明白的是,当我在我的 mac 上运行它时,它可以工作,但是每当我把它放在我的 Ubuntu 机器上时,我都会收到这个错误:

            const buyRoute = await getCoinQuote(
                         ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)
    at async link (internal/modules/esm/module_job.js:42:21)

【问题讨论】:

  • 你的 ubuntu 机器上的 node.js 有多久了?

标签: javascript node.js asynchronous async-await


猜你喜欢
  • 1970-01-01
  • 2013-04-18
  • 1970-01-01
  • 2015-01-26
  • 2021-12-08
  • 2017-04-07
  • 2017-03-15
  • 2017-06-09
  • 1970-01-01
相关资源
最近更新 更多