【发布时间】: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