I am trying to use puppeteer in my chrome extension using browserify. when I try to bundle the file it is giving me error Error: Can't walk dependency graph: Cannot find module 'puppeteer-core/internal/puppeteer-core.js' from '/home/user2912/Internship/Extention/Trial/work/chrome-ex copy/node_modules/puppeteer/lib/cjs/puppeteer/puppeteer.js'
This is the code where I am trying to node module
const puppeteer = require('puppeteer');
async function login(){
const browser = await puppeteer.launch({headless: true}); // Launch browser
const page = await browser.newPage(); // Open new page
await page.goto('https://www.linkedin.com/login'); // Go to LinkedIn login page
// Enter login credentials
await page.type('#username', 'user@gmail.com');
await page.type('#password', 'password');
await page.click('.btn__primary--large.from__button--floating');
await page.waitForNavigation();
console.log('Logged in successfully!');
const cookies = await page.cookies();
const jsessionid = cookies.find(cookie => cookie.name === 'JSESSIONID').value;
console.log(`JSESSIONID: ${jsessionid}`);
return jsessionid;
}
module.exports = { login };