jszip icon indicating copy to clipboard operation
jszip copied to clipboard

Cannot find module 'jszip' or its corresponding type declarations.

Open Fleuh opened this issue 3 years ago • 2 comments

Hey guys!

I have been working with JSZip to archive CSV outputs for years in a JS web app (using Node and React)

I am now working on a TypeScript app (with React and Node too) and need to use JSZip again. I was quite happy it had Typescript built-in directly!

However, when I try to import JSZip I get the following error from my browser (Firefox 95.0.1): Screenshot from 2022-03-08 15-49-05

I tried the following import methods:

import * as JSZip from "jszip"
// or 
import JSZip from "jszip"

I am using JSZip 3.7.1, and already found out the following issue which could have been a solution: https://github.com/Stuk/jszip/pull/614.

Other main packages of my app:

  • react : 16.14.0
  • @types/node: 12.20.10
  • webpack: 4.29.6

Even though the package is deprecated, I still tried to install @types/jszip 3.4.1 but it didn't fix the issue.

Any insight on what I'm doing wrong maybe?

Fleuh avatar Mar 08 '22 14:03 Fleuh

did you try running your local app on chrome ?? also try restarting VScode and the local server once....

appsplash99 avatar Mar 19 '22 09:03 appsplash99

Try deleting node_modules and reinstalling the packages.

jzombie avatar Jun 22 '22 16:06 jzombie