npm install
若在 Vercel 环境中缺少某些依赖项,可能需要手动添加某些依赖项到 package.json 文件中。
以下是示例代码,可以在 fetch 请求中进行调试:
fetch(url)
.then(res => {
if (!res.ok) {
throw Error(res.statusText);
}
return res.json();
})
.then(data => console.log(data))
.catch(error => console.log(error));