0

I'm currently writing an Android React Native app on VS Code using create-react-native-app and I'm trying to install some libraries to use, namely react-native-html-to-pdf.

In the documentation, after the npm install, it asks me to run a link command which returns an error saying

"Cannot read property 'pbxprojPath' of null".

Within my code, the import line import { RNHTMLtoPDF } from 'react-native-html-to-pdf' returns an error saying that the react-native-html-to-pdf module cannot be found.

How can I manually link this library with VS Code? I tried following the manual installation in the documentation but I believe that the Gradle files don't exist. If I try running the sample code provided to me, I get

Cannot read property 'convert' of undefined

as an error, so I presume that the library is not correctly linked.

Matei Radu
  • 2,038
  • 3
  • 28
  • 45
rrain
  • 61
  • 1
  • 9

1 Answers1

0

Applications created with create-react-native-app cannot link native modules unless you first eject.

So, you must first run npm run eject to be able to use the link command. However, note that ejecting is not reversable and your project structure and general setup will change a bit with this operation, so make sure to first read the official Ejecting documentation before proceeding.

Matei Radu
  • 2,038
  • 3
  • 28
  • 45