How to completely remove Puppeteer package from npm project

I installed Puppeteer some time ago for my Node.js project that was deployed on Heroku. After removing it from package.json and running npm install, I’m still having issues when pushing to my repository. The Chromium files that Puppeteer downloaded are still present and causing problems because they’re too large for the repository. What’s the proper way to fully uninstall Puppeteer and clean up all its downloaded dependencies including the browser files?

yep, puppeteer’s stuff is in the .cache folder. just delete that folder to remove everything, and also add it to your .gitignore to keep your repo clean.

The cache folder is indeed where Puppeteer stores its files, but it’s also essential to check node_modules/.cache/puppeteer specifically. Start by running npm uninstall puppeteer, then remove your entire node_modules folder and run npm install again. This process has been effective for me when I’ve faced issues with Puppeteer not being fully removed. Additionally, review package-lock.json for any remaining entries associated with Puppeteer that may need manual deletion. If you are deploying to Heroku, consider adding those cache directories to your .slugignore file to avoid complications with large files.

check your global npm cache too - puppeteer sometimes installs stuff there. run npm ls -g puppeteer to see if it’s globally installed, then remove it with npm uninstall -g puppeteer. also look for leftover .puppeteerrc config files in your project root.

I hit this exact problem with Puppeteer last year. After removing cache folders, check for any Puppeteer environment variables that might still point to the browser binaries. Run npm cache clean --force after uninstalling - it clears lingering npm cache references.

If you’re using CI/CD pipelines, clear their caches too since they cache those massive Chromium files. The chromium executable’s stubborn to remove completely. When I get persistent issues, I just nuke the entire node_modules directory and reinstall from scratch.

Also check your package-lock.json for indirect dependencies still pulling in browser packages.

Been there with Puppeteer cleanup headaches. Manual cache clearing works but gets tedious fast, especially with multiple projects or when working on a team.

I automate the whole thing now. Built a simple workflow that handles uninstall, cache clearing, node_modules rebuild, and gitignore updates in one shot. No more forgotten steps or teammates missing the cache cleanup.

It catches edge cases too - checks for leftover environment variables, auto-cleans CI cache, and even detects Heroku deployments to update your slugignore file.

This approach works for any messy package removal, not just Puppeteer. I’ve used it to clean up other heavy packages that leave artifacts everywhere.