Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Next.js: Module not found: Can't resolve 'canvg'

I have a next.js project and I keep getting:

error - ./node_modules/jspdf/dist/jspdf.es.min.js:458:25
Module not found: Can't resolve 'canvg'

I'm not sure why because I'm not including either jspdf or canvg.

Not sure what's causing it. Any help would be appreciated. I'm using material-ui if that matters.

like image 767
Shamoon Avatar asked Oct 23 '20 12:10

Shamoon


1 Answers

It seems dependency error means that particular Module is missing when it's running.

Run npm ls or yarn list will print to stdout all the versions of packages that are installed, as well as their dependencies, in a tree-structure. Then search for that particulate packages are listed or not. Run npm ls jspdf or yarn list jspdf then you can see its list of dependencies in tree-structure.

Please check your node version is updated or not ? If not then update first.

Quick & Dirty way: delete package.lock or yarn.lock file and delete .node_modules folders And Then run npm install or yarn to install again. Look at console while you installing and make sure there are no error in the installing process. If you saw error you better look that massages also.

like image 196
SHUVO MUSA Avatar answered Sep 29 '22 07:09

SHUVO MUSA