[英]Express sending assets with wrong MIME type
由于某种原因,现在必须指定安装路径:
app.use('/static', express.static(path.resolve(__dirname, '../client/dist/static')));
当404 Not Found
的响应状态时,您也会收到此消息,因此请仔细检查文件是否确实存在于“网络”选项卡中。
网络标签:
控制台标签:
在这里看到类似的问题: https : //stackoverflow.com/a/48792698/258772
是的,这里同样存在问题。
我现在正在ecstatic
(仍然与快递)。 我不确定这是否是解决方案(我不在导致错误发生的机器上)。
将尝试在“错误”计算机上删除它。
const express = require('express');
const ecstatic = require('ecstatic');
const http = require('http');
const app = express();
app.use(ecstatic({
root: `${__dirname}/public`,
showdir: false,
}));
http.createServer(app).listen(8080);
console.log('See if its cool on -> :8080');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.