采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
NuxtServerError Request failed with status code 500
这个不是编译的问题,也不是启动服务的问题,是接口内部出现错误导致500,控制台会有提示是哪个接口哪个文件出的问题,调试看看
嗯 你看我这个调试 我跑你那个项目就可以 但是这部分请求代码一样啊 签名也一样 。。。 router.get('/getPosition', async (ctx) => { console.log('into handle getPostion.......') try { var { status, data: { province, city } } = await axios.get(`http://cp-tools.cn/geo/getPosition?sign=${sign}`) } catch (e) { console.log(e, 'hahahah') into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... into handle getPostion....... { Error: getaddrinfo ENOTFOUND cp-tools.cn cp-tools.cn:80 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26) errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'cp-tools.cn', host: 'cp-tools.cn',
我调试出来了,await axios 不支持 似乎 换成then catch 就行了。。。。这个是为啥 我看安装包 一样啊
非常感谢!
登录后可查看更多问答,登录/注册
整合大前端8项技术,全面晋级全栈工程师,毕设/面试作品
1.1k 15
1.5k 12
1.2k 12
1.7k 12
2.8k 11