Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 连接另一台电脑时,React应用程序出现错误_Reactjs_Express - Fatal编程技术网

Reactjs 连接另一台电脑时,React应用程序出现错误

Reactjs 连接另一台电脑时,React应用程序出现错误,reactjs,express,Reactjs,Express,我已经开发了react应用程序,它连接到数据库和各种modbus设备。 当我试图连接另一台与本地电脑具有相同网络的电脑时,我遇到了一个错误:网络错误 首次渲染时,App.js请求db并从以下服务器代码获得响应: app.get("/programListele", function (req, res) { pool.connect((err, db, done) => { if (err) { console.log(err) return res.st

我已经开发了react应用程序,它连接到数据库和各种modbus设备。 当我试图连接另一台与本地电脑具有相同网络的电脑时,我遇到了一个错误:网络错误

首次渲染时,App.js请求db并从以下服务器代码获得响应:

app.get("/programListele", function (req, res) {
 pool.connect((err, db, done) => {
  if (err) {
  console.log(err)
  return res.status(400).send(err);
  } else {
   db.query('SELECT * FROM public."Programlar" ORDER BY "id" ASC', function (err, table) {
    done();
    if (err) {
      return res.status(400).send(err);
    } else {
      //db.end()
      return res.status(200).send(table.rows);       
    }
  });
}
问题是,当我从本地计算机运行react应用程序时,代码运行平稳,信息返回,但当我从另一台计算机运行react应用程序时出错。

我试过:

  • Postgresql远程访问连接已打开。我可以连接到数据库和另一台电脑在同一个地方 网络
  • 我已经请求与邮递员一起服务器,并且毫无问题地获得了数据

  • 对此我能做些什么?

    您使用的主机地址可能有问题。您确定没有使用
    localhost
    作为服务器吗?哪种类型的网络错误?请分享详细信息。@blankart是的,我使用的是localhost。我修好了,谢谢。问题已解决。您使用的主机地址可能有问题。您确定没有使用
    localhost
    作为服务器吗?哪种类型的网络错误?请分享详细信息。@blankart是的,我使用的是localhost。我修好了,谢谢。问题解决了。