J
J
jaygen2020-12-12 22:57:42
Node.js
jaygen, 2020-12-12 22:57:42

How to fix node js error?

I'm trying to use the whatsapp-web.js library.
running app.js on vps

const { Client } = require('whatsapp-web.js');
const client = new Client();

client.on('qr', (qr) => {
    // Generate and scan this code with your phone
    console.log('QR RECEIVED', qr);
});

client.on('ready', () => {
    console.log('Client is ready!');
});

client.on('message', msg => {
    if (msg.body == '!ping') {
        msg.reply('pong');
    }
});

client.initialize();

And I get an error
Error: Failed to launch the browser process!
0|a        | [1212/224305.004595:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
0|a        |
0|a        |
0|a        | TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
0|a        |
0|a        |     at onClose (/var/www/178-21-11-22.cloudvps.regruhosting.ru/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
0|a        |     at Interface.<anonymous> (/var/www/178-21-11-22.cloudvps.regruhosting.ru/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
0|a        |     at Interface.emit (events.js:326:22)
0|a        |     at Interface.close (readline.js:416:8)
0|a        |     at Socket.onend (readline.js:194:10)
0|a        |     at Socket.emit (events.js:326:22)
0|a        |     at endReadableNT (_stream_readable.js:1241:12)
0|a        |     at processTicksAndRejections (internal/process/task_queues.js:84:21)

How to fix ? nodejs -v 12 installed on server, Puppeteer library

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-12-12
@jaygen

https://stackoverflow.com/questions/59979188/error...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question