javascriptnode.jsqr-code

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')


While using whatsapp-web.js before a week I start to get this error.

Up to scanning qr code every thing is ok, but after canning qr code it returns following error

C:\SL\node\wa\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229
        throw new Error('Evaluation failed: ' + (0, util_js_1.getExceptionMessage)(exceptionDetails));
              ^

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
    at pptr://__puppeteer_evaluation_script__:5:95
    at ExecutionContext._ExecutionContext_evaluate (C:\SL\node\wa\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (C:\SL\node\wa\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:107:16)
    at async Client.initialize (C:\SL\node\wa\node_modules\whatsapp-web.js\src\Client.js:340:9)

So far I tried following steps, but issue is still there.

  1. Deleted .wwebjs_auth .wwebjs_cache, node_modules

  2. Re-installed all the packages

  3. Tried the solution as Error after scanning qr code for whatsapp-web.js

     client = new Client({
            authStrategy: new LocalAuth(),
            puppeteer: {
                headless: true,
                args: [ '--no-sandbox', '--disable-gpu', ],
            },
            webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html', }
        });
    
  4. Tried the solution as Npm package whatsapp-web.js broke

    const client = new Client({
      webVersionCache: {
        type: "remote",
        remotePath:
          "https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html",
      },
    });
    

Still getting same error message, your help will be highly appreciated.


Solution

    1. Install node v20.15.1
    2. npm install github:pedroslopez/whatsapp-web.js#webpack-exodus

    My issue is resolved with this