Open halofe opened 1 year ago
same error
How odd! Can you share the results of running with RUST_BACKTRACE=1
, as the error output indicates? That will help us see why it's going wrong that way.
我试过了,使用volta或者类似的node管理工具时,node和PM2安装是只给一个用户安装,所以在执行sudo命令时会有问题,可以尝试给root安装pm2解决。 因为这个问题我决定以后再也不用nvm,volta这种东西了
Edit by @chriskrycho: Adding an automated translation from Apple:
I have tried. When using volta or similar node management tools, node and PM2 installation are only installed for one user, so there will be problems when executing sudo commands. You can try to install pm2 for root.
Because of this problem, I decided not to use nvm and volta again.
The command succeed after sudo -i
➜ ~ pm2 startup
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/home/ubuntu/.volta/tools/image/node/21.1.0/bin /home/ubuntu/.volta/tools/image/packages/pm2/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu
➜ ~ sudo -i
root@e1:~# env PATH=$PATH:/home/ubuntu/.volta/tools/image/node/21.1.0/bin /home/ubuntu/.volta/tools/image/packages/pm2/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu
[PM2] Init System found: systemd
How odd! Can you share the results of running with
RUST_BACKTRACE=1
, as the error output indicates? That will help us see why it's going wrong that way.
Tried with RUST_BACKTRACE=1, error with "pm2 not found"