Node.js pm2服务中未识别生成文件夹
我正在使用ssh在vps ubuntu机器上运行我的node+react应用程序。 我使用nginx、pm2运行我的node js服务器,但当我检查日志时,它显示以下错误:Node.js pm2服务中未识别生成文件夹,node.js,reactjs,nginx,vps,pm2,Node.js,Reactjs,Nginx,Vps,Pm2,我正在使用ssh在vps ubuntu机器上运行我的node+react应用程序。 我使用nginx、pm2运行我的node 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..
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!
我要在其中发送react应用程序的节点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应用程序会显示,这意味着它正在工作。但是为什么我会在这里看到这个错误呢?
/root/repos/IRS-Ecommerce/IRS-Ecommerce/build/index.html
double-IRS-
电子商务orz仅为双倍。这不是一个错误。如果我将cd插入此路径,它将打开我的生成文件夹。我在我的问题中添加了图像,你们可以看到。