@types/pdfjs-dist/index.d.ts Cannot find name 'unknown'

I am new to ionic. I get the below error while running ionic serve.

Here’s my package.json file.

{

  "name": "mitra24",

  "version": "0.0.1",

  "author": "Ionic Framework",

  "homepage": "http://ionicframework.com/",

  "private": true,

  "scripts": {

    "clean": "ionic-app-scripts clean",

    "build": "ionic-app-scripts build",

    "lint": "ionic-app-scripts lint",

    "ionic:build": "ionic-app-scripts build",

    "ionic:serve": "ionic-app-scripts serve"

  },

  "dependencies": {

    "@angular/common": "^4.1.3",

    "@angular/compiler": "^4.1.3",

    "@angular/compiler-cli": "^4.1.3",

    "@angular/core": "^4.1.3",

    "@angular/forms": "^4.1.3",

    "@angular/http": "^4.1.3",

    "@angular/platform-browser": "^4.1.3",

    "@angular/platform-browser-dynamic": "^4.1.3",

    "@ionic-native/base64": "4.3.0 ",

    "@ionic-native/camera": "4.3.0 ",

    "@ionic-native/camera-preview": "4.3.0 ",

    "@ionic-native/core": "4.3.0 ",

    "@ionic-native/crop": "4.3.0 ",

    "@ionic-native/date-picker": "4.3.0 ",

    "@ionic-native/device-motion": "4.3.0 ",

    "@ionic-native/file": "4.3.0 ",

    "@ionic-native/file-chooser": "4.3.0 ",

    "@ionic-native/file-path": "4.3.0 ",

    "@ionic-native/file-transfer": "4.3.0 ",

    "@ionic-native/ftp": "4.3.0 ",

    "@ionic-native/geolocation": "4.3.0 ",

    "@ionic-native/google-maps": "^4.20.0",

    "@ionic-native/in-app-browser": "4.3.0 ",

    "@ionic-native/native-storage": "4.3.0 ",

    "@ionic-native/social-sharing": "4.3.0 ",

    "@ionic-native/spinner-dialog": "4.3.0 ",

    "@ionic-native/splash-screen": "4.3.2",

    "@ionic-native/status-bar": "4.3.2",

    "@ionic-native/toast": "4.7.0",

    "@ionic/storage": "2.1.3",

    "@types/googlemaps": "^3.37.0",

    "angular-archwizard": "4.0.0",

    "com-badrit-base64": "0.2.0",

    "cordova-android": "7.1.4",

    "cordova-plugin-camera": "~4.1.0",

    "cordova-plugin-camera-preview": "0.11.1",

    "cordova-plugin-crop": "0.4.0",

    "cordova-plugin-datepicker": "0.9.3",

    "cordova-plugin-device": "^1.1.4",

    "cordova-plugin-device-motion": "2.0.1",

    "cordova-plugin-file": "6.0.2",

    "cordova-plugin-file-transfer": "1.7.1",

    "cordova-plugin-filechooser": "1.0.1",

    "cordova-plugin-filepath": "~1.5.5",

    "cordova-plugin-ftp": "~1.1.1",

    "cordova-plugin-geolocation": "4.0.2",

    "cordova-plugin-googlemaps": "2.6.2",

    "cordova-plugin-inappbrowser": "3.0.0",

    "cordova-plugin-ionic-webview": "^4.1.1",

    "cordova-plugin-native-spinner": "~1.1.3",

    "cordova-plugin-nativestorage": "2.3.2",

    "cordova-plugin-splashscreen": "^4.0.3",

    "cordova-plugin-statusbar": "2.4.3",

    "cordova-plugin-whitelist": "^1.3.1",

    "cordova-plugin-x-socialsharing": "5.4.3",

    "cordova-plugin-x-toast": "~2.7.2",

    "cors": "^2.8.5",

    "es6-promise-plugin": "4.2.2",

    "font-awesome": "4.7.0",

    "intl": "^1.2.5",

    "ionic-angular": "^3.6.0",

    "ionic-img-viewer": "^2.9.0",

    "ionic-multi-camera": "^1.0.1",

    "ionic-plugin-keyboard": "^2.2.1",

    "ionic-selectable": "^3.4.0",

    "ionic2-calendar": "^0.4.6",

    "ionic2-super-tabs": "^5.2.0",

    "ionicons": "3.0.0",

    "moment": "^2.22.2",

    "ng2-pdf-viewer": "^5.2.3",

    "pdfmake": "^0.1.50",

    "rimraf": "^2.6.1",

    "rxjs": "^5.5.11",

    "sw-toolbox": "3.6.0",

    "tslint": "^4.5.1",

    "uuid": "^3.3.0",

    "ws": "^3.3.2",

    "zone.js": "0.8.18"

  },

  "devDependencies": {

    "@angular/cli": "^8.3.20",

    "@ionic/app-scripts": "^3.2.4",

    "typescript": "^2.7.2"

  },

  "description": "An Ionic project",

  "cordova": {

    "plugins": {

      "cordova-plugin-googlemaps": {},

      "ionic-plugin-keyboard": {},

      "cordova-plugin-whitelist": {},

      "cordova-plugin-device": {},

      "cordova-plugin-splashscreen": {},

      "cordova-plugin-ionic-webview": {},

      "cordova-plugin-camera": {},

      "cordova-plugin-x-toast": {},

      "cordova-plugin-filechooser": {},

      "cordova-plugin-file-transfer": {},

      "cordova-plugin-native-spinner": {},

      "cordova-plugin-filepath": {},

      "cordova-plugin-ftp": {},

      "cordova-plugin-crop": {},

      "cordova-plugin-datepicker": {},

      "cordova-plugin-geolocation": {

        "GEOLOCATION_USAGE_DESCRIPTION": " "

      },

      "cordova-plugin-inappbrowser": {},

      "cordova-plugin-x-socialsharing": {

        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"

      },

      "cordova-plugin-nativestorage": {},

      "cordova-plugin-device-motion": {},

      "cordova-plugin-statusbar": {},

      "cordova-plugin-camera-preview": {

        "ANDROID_SUPPORT_LIBRARY_VERSION": "26+"

      },

      "com-badrit-base64": {}

    },

    "platforms": [

      "android"

    ]

  },

  "config": {

    "ionic_copy": "./config/copy.config.js",

    "ionic_sass": "./config/sass.config.js"

  }

}

How to solve this issue?

Hey I had same issue, I tried so many things
like:

  1. Upgrade and downgrade TS and compiler version.
  2. Did some manual changes in pdfjs-dist/index.d.ts.
  3. Rebuild node modules and few more things at my end but none of them worked.

Thank fully I had backup so simply I replace src folder in my backup(Having UI and API changes in it) also replace node_modules and package.json. save my day after wasting one day.

note: don’t forget :shushing_face: to delete old package-lock.json

:+1: :+1: :+1: :+1: