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.
Contents
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.
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
- Could not find a version that satisfies the requirement
- fatal: detected dubious ownership in repository
- Failed! Error: SET PASSWORD has no significance for user ‘root’@’localhost’ as the authentication method used doesn’t store authentication data in the MySQL server