1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

systemd 経由で puma(Rails) 起動時に execjs が見つからないと言われた場合の対処法

Posted at

systemd でコマンド実行時にはユーザの .bashrc 等で設定される PAHT は読み込まれないため、明示的に設定してあげる必要あり。

たとえば、puma起動用の設定ファイルが/etc/systemd/system/puma.serviceとした場合以下のようにフォルダを作成。

$ mkdir /etc/systemd/system/puma.service.d

そのフォルダに xxx.conf を作成。

$ vi /etc/systemd/system/puma.service.d/env.conf

その中で環境変数を設定
以下のようにnodeコマンドが格納されているディレクトリに対して PATH が通るように設定する。(環境に応じて適宜設定すること)

[Service]
Environment="PATH=/home/ec2-user/.nvm/versions/node/v4.4.7/bin:/usr/bin"

上記の変更の後

$ sudo systemctl daemon-reload
$ sudo systemctl start puma

で puma を起動する

以上

1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?