小编ajs*_*ack的帖子

400(错误请求),并且找不到manifest.json

部署时,heroku告诉我我的构建成功,但是我得到Failed to load resource: the server responded with a status of 400 (Bad Request)了favicon和manifest,以及Manifest: Line: 1, column: 1, Unexpected token.Lighthouse告诉我它根本没有链接到manifest.json。我不确定这些是否相关,如果是这种情况,我将提出一个新问题。我在节点服务器上使用Reactjs。

这是我的server.js

const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const app = express();
const PORT = process.env.PORT || 3001;

app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());

if (process.env.NODE_ENV === "production") {
   app.use(express.static("client/build"));
}

app.get("*", (req, res) => {
  res.sendFile(path.join(__dirname, "./client/public/index.html"));
});


app.listen(PORT, function() {
  console.log(`  ==> API Server now listening on PORT ${PORT}!`);
}); …
Run Code Online (Sandbox Code Playgroud)

javascript heroku reactjs

4
推荐指数
1
解决办法
1640
查看次数

标签 统计

heroku ×1

javascript ×1

reactjs ×1