如何解决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应用程序出现,这表明它正在运行。但是为什么我在这里看到此错误?
解决方法
~/.ssh/authorized_keys
双重IRS-
电子商务orz
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。