Search code examples
typescriptionic-frameworkionic4jspdf

Ionic jspdf error cannot Module not found: Error: Can't resolve 'jspdf'


Commands I used:

npm install dom-to-image --save
npm install @types/dom-to-image --save
npm install jspdf --save
npm install @types/jspdf --save

My Code:

import domtoimage from 'dom-to-image';
import { File, IWriteOptions } from '@ionic-native/file/ngx';
import { FileOpener } from '@ionic-native/file-opener/ngx';
import * as jsPDF from 'jspdf';`

Resulting error:

[ng] ERROR in ./src/app/trail-balance-details/trail-balance-details.page.ts [ng] Module not found: Error: Can't resolve 'jspdf' in 'E:\ionic4\Accounting\src\app\trail-balance-details'


Solution

  • If you are using material-table, you need to upgrade it to the latest. This issue has been fixed on 1.63.1 version. Please use this command for doing so,

    npm uninstall material-table
    npm i material-table