首页 > 解决方案 > 如何通过 pm2 启动 actionhero

问题描述

我通过这个命令开始行动英雄

pm2 start .\node_modules\actionhero\bin\actionhero

但是 actionhero 没有成功启动,这在我的 pm2 日志中:

错误:在此项目中找不到配置目录,用 --config 指定,或在 process.env.ACTIONHERO_CONFIG 中找到

标签: node.jsnode-modulespm2actionhero

解决方案


我没有使用 actionhero 的经验,但它清楚地表明找不到配置目录。要么 1. --config 参数必须作为 pm2 start 的下一个参数传递,要么 2. 将环境变量 ACTIONHERO_CONFIG 设置为适当的值。

引导选项以查找配置目录

When launching ActionHero you can specify which config directory to use with --config '/path/to/dir' or the environment variable ACTIONHERO_CONFIG, otherwise ./config/ will be used from your working directory.

The priority of arguments is:

Use the project's ./config folder, if it exists.
actionhero --config=PATH1 --config=PATH2 --config=PATH3,PATH4
ACTIONHERO_CONFIG=PATH1,PATH2 npm start
Note that if --config or ACTIONHERO_CONFIG are used, they overwrite the use of the default /config folder. If you wish to use both, you need to re-specify "config", e.g. --config=config,local-config. Also, note that specifying multiple --config options on the command line does exactly the same thing as using one parameter with comma separators, however the environment variable method only supports the comma-delimited syntax.

推荐阅读