按照链接(https://technopy.com/deploying-a-flask-application-in-production-nginx-gunicorn-and-pm2-html-2/),我遵循了配置pm2设置的所有步骤,但服务器尚未启动。下面是遇到的消息的截图。

一旦输入命令pm2 list,就不会启动进程。
错误信息是:
2018-07-23T07:23:29.818Z] PM2 log: ===============================================================================
[2018-07-23T07:23:29.818Z] PM2 error: [PM2] Resurrecting PM2
Be sure to have the latest version by doing npm install pm2@latest -g before doing this procedure.
[PM2] Saving current process list...
/usr/local/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:26
buf = Buffer.alloc(SIZE)
^
TypeError: Buffer.alloc is not a function
at readUntilEnd (/usr/local/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:26:18)
at /usr/local/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:67:5
at FSReqWrap.oncomplete (fs.js:82:15)请提出前进的方向
我曾尝试过pm2 ,但仍未成功
FYI:
nodejs版本: 4.2.6
pm2 3.0.0
npm 6.1.0
发布于 2018-07-24 05:25:52
使用以下命令:
出口FLASK_APP=hello.py
$ pm2启动“烧瓶运行”
FYI:
Buffer.alloc需要NodeV4.5.0
发布于 2018-07-24 21:29:40
最新版本的pidusage (pm2的依赖项)随着您正在经历的错误(Buffer.alloc)而中断。这是一个已知的问题:https://github.com/soyuka/pidusage/issues/73
在正式修复被推送之前,您可能可以执行临时修复:
-var Buffer = require('safe-buffer') +var Buffer = require('safe-buffer').Buffer
在后面加上.Buffer就行了。
此补丁的功劳来自上述链接中的用户“watson”。
发布于 2020-08-11 08:42:04
pm2 start "FLASK_ENV=production FLASK_APP=my_code/app.py flask run -h 0.0.0.0 -p 5001 --with-threads"https://stackoverflow.com/questions/51464883
复制相似问题