Cannot find module 'puppeteer-core/internal/…'
Learn how to fix the 'Cannot find module' error when Puppeteer's internal modules are missing or corrupted

This error occurs when Node.js cannot find required internal modules from Puppeteer. This typically happens due to installation issues or version mismatches.
Common Causes
- Corrupted installation: Puppeteer installation is incomplete or damaged
- Version mismatch: Incompatible versions between puppeteer and puppeteer-core
- Node.js version issues: Using an incompatible Node.js version
- Package manager cache: Cached dependencies causing conflicts
Solutions
1. Clean reinstall of Puppeteer
# Remove existing installations
npm uninstall puppeteer puppeteer-core
# Clear npm cache
npm cache clean --force
# Install fresh copy
npm install puppeteer
2. Check and update Node.js version
Puppeteer requires Node.js 14 or higher. Check your version:
node --version
If needed, update Node.js:
# Using nvm (Node Version Manager)
nvm install 18
nvm use 18
# Or download from nodejs.org
3. Use specific versions
If you need to use puppeteer-core
, ensure versions match:
# Install specific versions
npm install puppeteer@21.0.0
npm install puppeteer-core@21.0.0
4. Clear node_modules and reinstall
# Remove node_modules and package-lock.json
rm -rf node_modules package-lock.json
# Reinstall dependencies
npm install
5. Check package.json
Ensure your package.json
has the correct dependencies:
{
"dependencies": {
"puppeteer": "^21.0.0"
// or if using puppeteer-core
// "puppeteer-core": "^21.0.0"
}
}
Still Encountering Issues?
If you’re still having trouble with module resolution, you can use a visual testing tool like Buglesstack to debug your automation setup and verify dependencies.
try {
await page.goto('https://www.google.com/search?q=puppeteer');
await page.waitForSelector('[name="q"]');
}
catch (error) {
// Prepare buglesstack data
const buglesstackData = {
url: page.url(),
screenshot: await page.screenshot({ encoding: 'base64' }),
html: await page.content(),
metadata: {},
message: error.message,
stack: error.stack
};
// Get your access token from https://app.buglesstack.com
const ACCESS_TOKEN = 'HERE_YOUR_ACCESS_TOKEN';
// Send error to buglesstack
await axios.post('https://app.buglesstack.com/api/v1/crashes', buglesstackData, {
headers: {
Authorization: `Bearer ${ACCESS_TOKEN}`,
'Content-Type': 'application/json'
}
});
// Re-throw the error to propagate it
throw error;
}
By ensuring proper installation and version compatibility, you can resolve the “Cannot find module” error and get your automation running smoothly.