Skip to content

[BUG] Error: Cannot find module 'node_modules\puppeteer-core\lib\cjs\puppeteer\common\Browser' #276

Closed

Description

@aeristhy

Environment

  • chrome-aws-lambda Version: "chrome-aws-lambda": "^10.1.0",
  • puppeteer / puppeteer-core Version: "puppeteer-core": "^14.1.1"
  • OS: Windows
  • Node.js Version: 16.x

Current Behavior

[2022-05-26 12:13:38]: ERROR Unhandled Rejection/Catch
Error: Cannot find module 'C:\Users\admin\Desktop\Codes\dota-coach-bot\node_modules\puppeteer-core\lib\cjs\puppeteer\common\Browser'

const chromium = require('chrome-aws-lambda');

async function test(url) {
			const browser = await chromium.puppeteer.launch({
				executablePath: await chromium.executablePath,
				headless: chromium.headless,
			});
			const page = await browser.newPage();
			await page.goto(url);

			const [dota2] = await page.$x('/html/body/div[2]/div[2]/div[1]/div/div[10]/span[2]');
			const txt = await dota2.getProperty('textContent');
			const rawText = await txt.jsonValue();

			const [steamwebapi] = await page.$x('/html/body/div[2]/div[2]/div[1]/div/div[6]/span[2]');
			const txt2 = await steamwebapi.getProperty('textContent');
			const rawText2 = await txt2.jsonValue();


			const [wholepage] = await page.$x('/html/body/div[2]/div[2]/div[1]/div');
			await wholepage.screenshot({ path: './assets/screenshots/stats.png' });

			const file = new MessageAttachment('./assets/screenshots/stats.png');
			const embed = new MessageEmbed()
				.setTitle('Steam Status')
				.setURL('https://steamstatus.com/')
				.addFields(
					{ name: '<:dota2:979197867774312539> Dota 2 Coordinator', value: `${rawText}`, inline: false },
					{ name: '<:steam:979198111102685194> Steam Web API', value: `${rawText2}`, inline: false },
				)
				.setImage('attachment://stats.png')
				.setFooter({ text: 'This is an Automated Message' });

			message.channels.cache.get('979217012465233960').send({ embeds: [embed], files: [file] }).then(async (m) => {
				setTimeout(() => m.delete(), 10000);
			});
			console.log({ rawText });
			await browser.close();
		}
		test('https://steamstat.us/');

Activity

  1. added
    bug
    on May 26, 2022
  2. tarasromil commented on May 26, 2022

    @tarasromil

    Have the same issue with puppeteer v14

  3. aosbornee commented on May 26, 2022

    @aosbornee

    Same issue on my end, would downgrading to a specific version help?

  4. tarasromil commented on May 26, 2022

    @tarasromil

    13.7.0 works fine for me

  5. aeristhy commented on May 26, 2022

    @aeristhy
    Author

    @sparticuz/chrome-aws-lambda is the fix for this

  6. experionsachin commented on Mar 23, 2023

    @experionsachin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions