LoginSignup
3
2

More than 5 years have passed since last update.

pm2で環境変数の変更が反映されない時の解決策

Posted at

問題

pm2を用いてnode.jsのアプリを管理している場合、外部で環境変数を変更した際に、そのアプリ側では変更が反映されないことがあります。
私の場合、パソコンを再起動すらしても反映されず、弱りました。

解決策

そんなときは、--update-env を付けてアプリを再起動すればOKです。

$ pm2 restart 0 --update-env

上記は再起動するアプリのIDが0である場合です。
ちなみに、アプリのIDは下記で確認することができます。

$ pm2 list

参考

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2