简体   繁体   English

为什么 pm2 可以,但 pm2 日志不行?

[英]Why pm2 is fine, but pm2 logs is not?

I'm using pm2 to keep tracking of what I do on backend with NodeJS.我正在使用 pm2 来跟踪我在后端使用 NodeJS 所做的事情。 Until yesterday it all worked perfectly fine, but today, even if pm2 server is working fine (i can start the project server and i can navigate), pm2 logs just stopped for no reasons.直到昨天,一切都运行良好,但今天,即使 pm2 服务器运行良好(我可以启动项目服务器并且可以导航),pm2 日志也会无缘无故地停止。

在此处输入图片说明

Here you can see the version I'm using (i already updated PM2 both on project and local as i find in other answers).在这里你可以看到我正在使用的版本(我已经在项目和本地更新了 PM2,正如我在其他答案中找到的那样)。
I usually use the command我通常使用命令

pm2 start process.json
pm2 restart 0 --watch
pm2 restart 0

And in other prompt instance, for the logs i use在其他提示实例中,对于我使用的日志

pm2 logs

For some reason PM2 is just tailgating the last 15 lines but it doesn't work real time like it used to do出于某种原因,PM2 只是尾随最后 15 行,但它不像以前那样实时工作

在此处输入图片说明

I didn't find this exact problem on other questions (only questions about pm2 not working at all, but not about pm2 working half way).我在其他问题上没有发现这个确切的问题(只有关于 pm2 根本不起作用的问题,而不是关于 pm2 工作一半的问题)。 Any suggestions?有什么建议?

Apparently the version of node and pm2 were the source of the problem.显然 node 和 pm2 的版本是问题的根源。 I used this command to run pm2 using the node version explicitly我使用此命令明确使用节点版本运行 pm2

pm2 start process.json --interpreter=/home/ken/.nvm/v10.15.1/bin/node

This way you force pm2 to use settings for the version of node you've installed in your machine.通过这种方式,您可以强制 pm2 使用您机器中安装的节点版本的设置。 Now both server and logs works fine.现在服务器和日志都可以正常工作。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM