简体   繁体   English

Express Node.js react 集成(拒绝应用样式,加载资源失败)

[英]Express Node.js react integration( Refused to apply style and failed to load resource)

first of all, i integrated an skeleton of a react app with express node js, and it works good.首先,我用 express node js 集成了一个 react 应用的骨架,效果很好。 But when i try with an existing app i'm getting from server:但是当我尝试使用现有应用程序时,我从服务器获取:

来自服务器的错误

The code of the small server is:小服务器的代码是:

const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const app = express();
app.use(express.static(path.join(__dirname, "build")));

app.get("/ping", function(req, res) {
  return res.send("pong");
});

app.get("/", function(req, res) {
  res.sendFile(path.join(__dirname, "build", "index.html"));
});

app.listen(process.env.PORT || 8080);

It seems like you don't have the folder agora-ux inside your build folder, which is why it's giving a 404 Not Found error.您的build文件夹中似乎没有agora-ux文件夹,这就是它给出 404 Not Found 错误的原因。

Try to add that folder and then it will work fine.尝试添加该文件夹,然后它会正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Heroku + Node.js + Peer.js(webrtc):无法加载资源:net :: ERR_CONNECTION_REFUSED - Heroku + Node.js + Peer.js (webrtc): Failed to load resource: net::ERR_CONNECTION_REFUSED 无法获取本地html文件与本地Express Node.js服务器对话。 无法加载资源:net :: ERR_CONNECTION_REFUSED - Cannot get local html file to talk to local express Node.js server. Failed to load resource: net::ERR_CONNECTION_REFUSED Heroku Node.js 应用程序拒绝应用样式,因为它的 MIME 类型 - Heroku Node.js app refused to apply style because its MIME type SQL-Node.js表达-反应负载行为 - SQL - node.js express - react load behavior Node.js / Express静态资产连接被拒绝 - Node.js/Express static assets connection refused Node.js Express.js PayPal 集成 - Node.js Express.js PayPal integration 在 node.js express、mysql 中使用 react - Using react in node.js express, mysql 无法连接到本地主机端口 8000:Node.js 中的连接被拒绝 - Failed to connect to localhost port 8000: Connection refused in Node.js 通过在node.js代码上应用ajax未能加载资源:net :: ERR_EMPTY_RESPONSE错误 - Failed to load resource: net::ERR_EMPTY_RESPONSE error by applying ajax on a node.js code 我的第一个Node.js服务器:无法加载资源:net :: ERR_INCOMPLETE_CHUNKED_ENCODING - My First Node.js server : Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM