1

I try this solution but i keep the same problem.

yarn global add pm2 -> ok

sudo pm2 status -> sudo: pm2: command not found

pm2 status -> -bash: pm2: command not found

In my ~/.bashrc i add the following line :

export PATH=$PATH:usr/bin/pm2

because whereis pm2 return /usr/bin/pm2 but nothing change

I test this path too : yarn bin -> /home/user/node_modules/.bin but nothing too

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Hadock
  • 796
  • 1
  • 12
  • 28

1 Answers1

6

Solution :

find * -name "pm2"

i got some line :

home/myUser/.config/yarn/global/node_modules/pm2
home/myUser/.config/yarn/global/node_modules/pm2/pm2
home/myUser/.config/yarn/global/node_modules/pm2/bin/pm2
home/myUser/.config/yarn/global/node_modules/pm2/lib/templates/logrotate.d/pm2
home/myUser/.config/yarn/global/node_modules/.bin/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/bin/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/.bin/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/lib/templates/logrotate.d/pm2
home/myUser/.yarn/bin/pm2

i test each :

home/myUser/.yarn/bin/pm2 ls

one work : home/myUser/.yarn/bin/pm2

so i edit my bashrc with export PATH=$PATH:home/myUser/.yarn/bin/

and test :

xxxxx@xxxxx:/$ pm2 ls
┌────┬─────────────────────────┬─────────┬─────────┬──────────┬────────┬──────┬──────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name                    │ version │ mode    │ pid      │ uptime │ ↺    │ status   │ cpu      │ mem      │ user     │ watching │
├────┼─────────────────────────┼─────────┼─────────┼──────────┼────────┼──────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ 1  │ main                    │ 0.0.1   │ fork    │ 15499    │ 44s    │ 136  │ online   │ 0.2%     │ 76.3mb   │ xxxxx    │ disabled │
│ 2  │ main                    │ 0.0.1   │ fork    │ 15470    │ 59s    │ 29   │ online   │ 0.2%     │ 77.3mb   │ xxxxx    │ disabled │
│ 0  │ node                    │ N/A     │ fork    │ 0        │ 0      │ 60   │ errored  │ 0%       │ 0b       │ xxxxx    │ disabled │
└────┴─────────────────────────┴─────────┴─────────┴──────────┴────────┴──────┴──────────┴──────────┴──────────┴──────────┴──────────┘

Hadock
  • 796
  • 1
  • 12
  • 28