Skip to content
FLAVIO COPES
flaviocopes.com
2026

Fix “Module not found: Can't resolve encoding” in Next.js

By Flavio Copes

Fix the 'Module not found: Can't resolve encoding' error in Next.js, coming from node-fetch, by running npm install encoding to add the missing package.

~~~

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!

~~~

Related posts about next: