Yêu cầu khoảng 3 giờ trước 4 0 0
  • 4 0 0
0

Lỗi GET file img, js khi deploy NodeJS

Chia sẻ
  • 4 0 0

Chào mọi người. Mình đang viết 1 website sử dụng nodejs, express. trong file app.js mình đã cấu hình static file: app.use(express.static(path.join(__dirname, 'public')));

Folder mình như sau: -app.js -src --public ---js ---css ---img Khi chạy trên local thì k báo lỗi, nhưng deploy lên thì báo lỗi /img/logo.png 502 (Bad Gateway) /img/favicon.ico 502 (Bad Gateway) /js/scripts.js net::ERR_ABORTED 502 (Bad Gateway) Refused to execute script from 'https://.../js/flowbite.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.|

Nhờ mọi người hướng dẫn cách sửa lỗi này. Mình cám ơn!

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí