JSZip node package fails to build in CloudCode

I am trying to zip a mp3 file which is downloaded from a url.
I added the jszip npm package and the @types/jszip package via the OXIDE action to my CloudCode task.

When I test the task the following error is shown:

  "status": 500,
  "description": "CloudCode deploy invocation failed",
  "details": "CLOUDCODE/BUILD/BUILD_FAILED [download:1.11.2]: node_modules/jszip/index.d.ts(33,11): error TS2304: Cannot find name 'Blob'.\nnode_modules/jszip/index.d.ts(45,11): error TS2304: Cannot find name 'Blob'.",
  "trace_id": "9bf860a57c5a928527ac99800309f8b1",
  "severity": "info",
  "origin": "CLOUD_CODE"

How can I resolve this error?

This is a typings issue in jszip. The easiest workaround is to change your task’s tsconfig.json to this:

  "extends": "@journeyapps/cloudcode-build/task-tsconfig",
  "compilerOptions": {
    "skipLibCheck": true

There are also other options such ‘archiver’ for NodeJS.

1 Like