天天看點

微信小程式 報錯“ the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error)”解決方案

微信開發者工具 報錯:“VM478:1 Failed to load local image resource 路徑,the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error) ”

最近在做小程式的登入頁面時候,發現了這個錯誤,導緻頁面的圖檔無法正常顯示出來。

微信小程式 報錯“ the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error)”解決方案
微信小程式 報錯“ the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error)”解決方案

系統提示渲染層網絡層錯誤,通過對比自己的源碼和錯誤提示,發現是圖檔的路徑出現了問題。

源碼:

<view class="inputView"> 
  <image class="nameImage" src="../images/name.png"></image> 
  <label class="loginLab">賬号</label> 
  <input class="inputText" placeholder="請輸入賬号" bindinput="phoneInput" /> 
 </view> 
           

錯誤提示:

Failed to load local image resource /pages/images/loginLog.jpg
           

通過檢視圖檔實際所在位置,發現檔案夾pages下并沒有images檔案。

解決方案:

1. 在檔案夾pages下的accouts裡面建立一個images,并将登入頁面所用到的3張圖檔儲存到images裡面。
微信小程式 報錯“ the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error)”解決方案
2.重新編譯後,登入頁面的圖檔正常加載出來,錯誤解決!
微信小程式 報錯“ the server responded with a status of 500 (HTTP/1.1 500 Internal Server Error)”解決方案