LoginSignup
10
8

More than 5 years have passed since last update.

express4でpm2のwatchが動かない

Posted at

pm2でwatchされない

nodeで開発している時、pm2が大変便利。
ただ、express4で初期化したプロジェクトにてwatchが動かなくて困った。

➜  pm2_test$  sudo pm2 start bin/www --watch
# app.jsとか更新しても全然リスタートされない

これでwatchされた。

起動スクリプトをプロジェクトルートに移動

➜  pm2_test$  mv bin/www ./ 

package.jsonのstartを修正

package.json
  "scripts": {
    "start": "node ./www"
  },

起動ファイル以下のディレクトリしか監視しないっぽい?
見た感じ、指定したディレクトリを追加で監視できそうな気も。。。
https://github.com/Unitech/PM2/blob/a971babeb692fcab052fa905d52aee0eb4bd1382/lib/Watcher.js#L25-L49

10
8
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
10
8