pm2服务无法识别构建文件夹

问题描述

我正在使用ssh在vps ubuntu机器上运行我的node + react应用程序。 我使用Nginx,pm2来运行节点js服务器,但是当我检查日志时,它显示以下错误

App [server:0] starting in -fork mode-
PM2        | 2020-09-16T07:05:03: PM2 log: App [server:0] online
PM2        | 2020-09-16T07:06:18: PM2 log: Reloading logs...
PM2        | 2020-09-16T07:06:18: PM2 log: Reloading logs for process id 0
PM2        | 2020-09-16T07:38:58: PM2 log: Stopping app:server id:0
PM2        | 2020-09-16T07:38:58: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
PM2        | 2020-09-16T07:38:58: PM2 log: pid=6888 msg=process killed
PM2        | 2020-09-16T07:38:58: PM2 log: App [server:0] starting in -fork mode-
PM2        | 2020-09-16T07:38:58: PM2 log: App [server:0] online 

0|server   | Error: ENOENT: no such file or directory,stat '/root/repos/irs-Ecommerce/irs- 
Ecommerce/build/index.html'

/root/.pm2/logs/server-out.log last 15 lines:
0|server   | Server is up and running at port : 8080
0|server   | MongoDB connected successfully!

我的节点js服务器文件,我将响应应用发送到该文件

 app.use(express.static("irs-Ecommerce/build"));
 app.get("*",(req,res) => {
    res.sendFile(path.join(__dirname,"irs-Ecommerce","build","index.html"));
 });

我已经在我的react应用程序中运行了npm build并且那里存在build文件夹,但是它显示了index.html不存在的错误。我已经检查了路径,这是正确的。

当我访问公共IP时,我的react应用程序出现,这表明它正在运行。但是为什么我在这里看到此错误

enter image description here

解决方法

~/.ssh/authorized_keys双重IRS- 电子商务orz