Next.js: Module not found: Can’t resolve ‘canvg’


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

error - ./node_modules/jspdf/dist/
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.


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.

Leave a Reply

Your email address will not be published. Required fields are marked *