后端使用npm run start啟動,前端使用npm run serve啟動,使用postman能請求數據。但是谷歌瀏覽器控制台出現“500”錯誤network出現錯誤:
Proxy error: Could not proxy request /shops?longitude=40.10038&latitude=116.36867 from localhost:8082 to http://localhost:4000/ (HPE_INVALID_VERSION
一般都是端口占用的問題,把自己的前后台都關了,然后使用cmd查看端口是否占用.步驟如下:
執行 netstat -aon|findstr “4000”,找到PID,發現PID為“3332”和“5248”被占用 4000是你目前項目使用的端口號
執行tasklist|findstr “PID” 尋找相應的進程;
執行命令taskkill /f /t /im 程序名.exe 結束進程
然后修改服務器端口,相應修改客戶端proxy跨域端口,端口由“4000”改為“5000”