user19921081
user19921081

Reputation: 11

Module not found: Can't resolve 'base64-js' error every time I try to create and run a next app

After creating a nextjs app, I tried running npm run dev and got this error:

error ../../node_modules/buffer/index.js:11:0
Module not found: Can't resolve 'base64-js'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/next/dist/compiled/util/util.js
./node_modules/next/dist/compiled/micromatch/index.js
./node_modules/next/dist/shared/lib/match-remote-pattern.js
./node_modules/next/dist/shared/lib/image-loader.js
./node_modules/next/dist/client/image-component.js

I have tried installing, reinstalling and updating node, npm, next and also tried installing the base64-js module. I also tried to trace the error to the file mentioned in the error, but was not able to find anything.

Please let me know if anyone has a solution

Upvotes: 1

Views: 829

Answers (1)

Ponmani Chinnaswamy
Ponmani Chinnaswamy

Reputation: 861

Try these steps

  1. Delete the "node_modules" folder
  2. Remove the "package-lock.json" file
  3. run "npm install"

Upvotes: 0

Related Questions