When I ssh to my user and run node script.js, it's working fine.
When I do that via forever in ssh, pm2 start script.js, or when I do via PHP like below
<?php
// Define the command
$command = "pm2 start /home/example.com/app4test.js";
// Execute the command
$output = exec($command);
// Output the result
echo "<pre>$output</pre>";
?>
I get below error
(Use `node --trace-warnings ...` to show where the warning was created)
/home/example.com/node_modules/@puppeteer/browsers/lib/cjs/launch.js:310
reject(new Error([
^
Error: Failed to launch the browser process!
cannot join mount namespace of pid 1: Operation not permitted
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at Interface.onClose (/home/tradingtoolx.com/node_modules/@puppeteer/browsers/lib/cjs/launch.js:310:24)
at Interface.emit (node:events:531:35)
at Interface.close (node:internal/readline/interface:528:10)
at Socket.onend (node:internal/readline/interface:254:10)
at Socket.emit (node:events:531:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v20.15.0
{"level":"error","message":"Forever detected script exited with code: 1"}
Also when I do this via pm2, I get the same above error from ssh as well as PHP script.
I have simple Puppeteer script in Nodejs like below
When I ssh to my user and run node script.js, it's working fine.
When I do that via forever in ssh,
pm2 start script.js
, or when I do via PHP like belowI get below error
Also when I do this via pm2, I get the same above error from ssh as well as PHP script.