close

[Solved] Attempted import error: ‘create’ is not exported from ‘fontkit’

I am trying to use react-pdf package and I am facing the following issue Attempted import error: ‘create’ is not exported from ‘fontkit’ (imported as ‘fontkit’) I have Researched about this error And I have Solved this error and All method That I have Tried and Got succeed That method I am going to share in this tutorial.

How To Fix Attempted import error: ‘create’ is not exported from ‘fontkit’?

How To Fix Attempted import error: ‘create’ is not exported from ‘fontkit’?

To Fix Attempted import error: ‘create’ is not exported from ‘fontkit’ You just need to download react-pdf/rendered and react-pdf/font to the lower version. First of all Open Your Package.json file and Change react-pdf/rendered to the 2.1.0 and react-pdf/font to the 2.2.0: “@react-pdf/rendered”:” 2.1.0″, “@react-pdf/font”: “2.2.0”, And then you need to add resolutions in your Package.json: “resolutions”: { “@react-pdf/font”: “2.2.0” }, And now, You can run your project without any error.

Attempted import error: ‘create’ is not exported from ‘fontkit’

To Fix Attempted import error: ‘create’ is not exported from ‘fontkit’ You just need to download react-pdf/rendered and react-pdf/font to the lower version. First of all Open Your Package.json file and Change react-pdf/rendered to the 2.1.0 and react-pdf/font to the 2.2.0: “@react-pdf/rendered”:” 2.1.0″, “@react-pdf/font”: “2.2.0”, And then you need to add resolutions in your Package.json: “resolutions”: { “@react-pdf/font”: “2.2.0” }, And now, You can run your project without any error.

Solution 1: Downgrade react-pdf/rendered and react-pdf/font

To Fix Attempted import error: ‘create’ is not exported from ‘fontkit’ You just need to download react-pdf/rendered and react-pdf/font to the lower version. First of all Open Your Package.json file and Change react-pdf/rendered to the 2.1.0 and react-pdf/font to the 2.2.0.

"@react-pdf/rendered":" 2.1.0",
"@react-pdf/font": "2.2.0",

And then you need to add resolutions in your Package.json.

"resolutions": {
    "@react-pdf/font": "2.2.0"
},

And now, You can run your project without any error.

Also, Read

Leave a Comment