"html-pdf: Failed to load PhantomJS module.
วิธีแก้ไขเอาขึ้น server linux แล้ว "error phantomjs-prebuilt"
1. ลบ lib: phantomjs-prebuilt ด้วยคำสั่ง rm -rf node_modules/phantomjs-prebuilt
2.ติดตั้งใหม่ ด้วยคำสั่ง npm install phantomjs-prebuilt
---------------------------------------------
ref: https://github.com/marcbachmann/node-html-pdf/issues/212
ref: https://www.javascripttutorial.net/nodejs-tutorial/npm-list/
In my case this solved the issue: I am not an expert, but it seems that since html-pdf is installed globally you have to link these global installations to your project. So my installation looks like this:
If this is somehow not the real way to go, I would be happy about other suggestions as I am planning to use this for an upcoming project. |
@glenn-allen thank you. I combined your solution with this: uncss/uncss#165 and it works well. Here's how I resolve my error:
|
hi ,i'm trying to use html-pdf module , but it throws "html-pdf: Failed to load PhantomJS module. You have to set the path to the PhantomJS binary using 'options.phantomPath" error ,
steps i tried to resolve :
1.
installed html-pdf
2.
rm -rf node_modules/phantomjs-prebuilt
(ornpm uninstall phantomjs-prebuilt
)3.
npm install phantomjs-prebuilt@2.1.13
(andphantomjs-prebuilt@2.1.4
)but no use , it was throwing same error , then i assigned
options.phantomPath
tonode_modules\phantomjs-prebuilt
after that it is throwing following error , please help
{"error":{"message":"spawn EACCES","stack":"Error: spawn EACCES\\n at _errnoException (util.js:1022:11)\\n at ChildProcess.spawn (internal/child_process.js:323:11)\\n at Object.exports.spawn (child_process.js:502:9)\\n at PDF.PdfExec [as exec] (/root/PGServerJs/node_modules/html-pdf/lib/pdf.js:88:28)\\n at PDF.PdfToFile [as toFile] (/root/PGServerJs/node_modules/html-pdf/lib/pdf.js:83:8)\\n
i tried to change the permissions of phantomjs , but still it is not working
The text was updated successfully, but these errors were encountered: