Fix “Module not found: Can't resolve encoding” in Next.js
New Courses Coming Soon
Join the waiting lists
I ran into this error in a Next.js application:
Module not found: Can’t resolve ‘encoding’ in …/node_modules/node-fetch/lib’
To fix this, I ran npm install encoding
and the error was gone!
→ Get my Next.js (pages router) Handbook
Here is how can I help you:
- COURSES where I teach everything I know
- CODING BOOTCAMP cohort course - next edition in 2025
- BOOKS 16 coding ebooks you can download for free on JS Python C PHP and lots more
- Follow me on X