node-html-pdf icon indicating copy to clipboard operation
node-html-pdf copied to clipboard

html-pdf lib error

Open hariaravind10 opened this issue 3 years ago • 5 comments

AssertionError [ERR_ASSERTION]: html-pdf: Failed to load PhantomJS module. You have to set the path to the PhantomJS binary using 'options.phantomPath' at new PDF (path of my folder/node_modules/html-pdf/lib/pdf.js:40:3) at Object.createPdf [as create] (/path of my folder/node_modules/html-pdf/lib/index.js:10:14)

hariaravind10 avatar Aug 12 '21 12:08 hariaravind10

I have recently initialized and installed html-pdf, it appears that the new path to the PhantomJS Binary is in node_modules/phantomjs-prebuilt/bin/phantomjs instead of node_modules/phantomjs/bin/phantomjs.

BriniM avatar Aug 13 '21 01:08 BriniM

How to solve the issue.. Please send the steps to solve this.

I am getting html-pdf in local but i didn't get it on AWS ec2 RHEL server.

Please help me

hariaravind10 avatar Aug 13 '21 01:08 hariaravind10

You need to install the phantam js prebuilt manuallyto the node_modules directory in the project. Remove the existing phantomjs-prebuilt and the install the library manually.

I did it by adding the following lines in my dockerfile

RUN cd node_modules/
&& rm -r phantomjs-prebuilt
&& wget -qO- "https://github.com/dustinblackman/phantomized/releases/download/2.1.1a/dockerized-phantomjs.tar.gz" | tar xz -C /
&& npm config set user 0
&& npm install phantomjs-prebuilt

Add this line as the last step in docker file before the CMD line

nishvs avatar Aug 18 '21 14:08 nishvs

You need to install the phantam js prebuilt manuallyto the node_modules directory in the project. Remove the existing phantomjs-prebuilt and the install the library manually.

I did it by adding the following lines in my dockerfile

RUN cd node_modules/ && rm -r phantomjs-prebuilt && wget -qO- "https://github.com/dustinblackman/phantomized/releases/download/2.1.1a/dockerized-phantomjs.tar.gz" | tar xz -C / && npm config set user 0 && npm install phantomjs-prebuilt

Add this line as the last step in docker file before the CMD line

I am not able to install the phantomjs-prebuilt plese help me I am not using the docker, I am using ec2 instance and directly run the node using pm2.

hariaravind10 avatar Aug 19 '21 11:08 hariaravind10

#8

atrvicky avatar Oct 25 '22 06:10 atrvicky