1. 程式人生 > 其它 >TypeError: Cannot read property ‘url‘ of undefined 問題已解決

TypeError: Cannot read property ‘url‘ of undefined 問題已解決

技術標籤:nodejs

在做web後端伺服器時,獲取url時出現TypeError: Cannot read property ‘url’ of undefined

在這裡插入圖片描述

仔細檢視後是

ctx.require.url

不是require而是requist,跟著VScode提示走,也得注意使用正確

const url=ctx.request.url   
console.log(url)

在這裡插入圖片描述

在這裡插入圖片描述

問題已解決,來看看你們是不是同樣的錯誤