我试图部署到 Vercel 我之前已经在其他项目中完成了它,但在这种情况下,构建失败,它提到它没有找到页脚组件,构建在本地机器上完美运行。
11:55:14.850 Cloning completed in 533ms
11:55:14.851 Analyzing source code...
11:55:17.183 Installing build runtime...
11:55:17.605 Build runtime installed: 422.099ms
11:55:18.023 Looking up build cache...
11:55:18.054 Build cache not found
11:55:18.481 Installing dependencies...
11:55:18.694 yarn install v1.22.4
11:55:18.757 [1/4] Resolving packages...
11:55:19.090 [2/4] Fetching packages...
11:55:27.361 info fsevents@2.1.3: The platform "linux" is incompatible with this module.
11:55:27.361 info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
11:55:27.365 info fsevents@1.2.13: The platform "linux" is incompatible …Run Code Online (Sandbox Code Playgroud) 我目前正在学习如何使用ES8的fetch,async等待我目前有这个代码可以工作:
const url = "https://api.icndb.com/jokes/random";
async function tellJoke() {
let data = await (await fetch(url)).json();
return data.value.joke;
}
tellJoke().then(data => console.log(data));
Run Code Online (Sandbox Code Playgroud)
安慰:
"Chuck Norris can dereference NULL."
Run Code Online (Sandbox Code Playgroud)
但是我发现了一个使用箭头功能的片段,问题是我不知道如何在我当前的例子中按照我的方式返回我的值.
片段:
const fetchAsync = async () =>
await (await fetch(url)).json()
Run Code Online (Sandbox Code Playgroud)
如果这不是最佳做法让我知道,欢迎任何进一步阅读.
javascript async-await arrow-functions fetch-api ecmascript-2017