Код: Выделить всё
const puppeteer = require("puppeteer");
(async () => {
const browser = await puppeteer.launch({
headless: true,
executablePath: "/snap/bin/chromium",
args: ["--no-sandbox", "--disable-setuid-sandbox"],
});
const page = await browser.newPage();
await page.goto("https://google.com");
//get screenshot
await page.screenshot({ path: "app4test.png" });
})();
Когда я делаю это через навсегда в ssh .. скрипт навсегда .js, он работает нормально..
но когда я делаю это через php,
Код: Выделить всё
Код: Выделить всё
(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"}
Подробнее здесь: https://stackoverflow.com/questions/787 ... -permitted