title: html-pdf: Failed to load PhantomJS module. You have to set the path to the PhantomJS binary using 'options.phantomPath' when using aws ec2
body: <p>i have EC2 instance running in aws. after i deploy to the server. all workking fine until i check html-pdf. everytime i hit the api to create pdf, i check the log and the result is:</p>
  <p><a href="https://i.stack.imgur.com/Uq4YL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uq4YL.png" alt="enter image description here" /></a></p>
  <p>i already try to unninstall html pdf using <strong>npm uninstall html-pdf</strong> then install again with <strong>npm install html-pdf</strong></p>
  <p>and i already try with <strong>npm link phantomjs-prebuilt</strong> but still have the same result. when i check with local everything working fine, does anyone have same issue like this and already solved? thanks!</p>
  <p>*update:</p>
  <p>i already try with install phantomjs global, and set the phantom path using:</p>
  <pre><code>&quot;phantomPath&quot;:&quot;../../../../../usr/local/lib/node_modules/phantomjs-prebuilt/bin/phantomjs&quot;
  </code></pre>
  <p>the path i got from the node modules:</p>
  <p><a href="https://i.stack.imgur.com/gHWdL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gHWdL.png" alt="enter image description here" /></a></p>
  <p>this is my code:</p>
  <pre><code>createOwn: async function (req, res, next) {
        try {
            const owner = await getOwnership(req.params.id);
            const name = await Date.now();
            ejs.renderFile(path.join(__dirname, './template', &quot;own.template.ejs&quot;), { own: owner, moment: moment, }, (err, data) =&gt; {
                if (err) {
                    console.log(err);
                    return res.status(500).json({ status: &quot;error&quot;, data: err });
                } else {
                    let options = {
                        &quot;format&quot;: &quot;A4&quot;,
                        &quot;orientation&quot;: &quot;portrait&quot;,
                        &quot;phantomPath&quot;: &quot;../../../../../usr/local/lib/node_modules/phantomjs-prebuilt/bin/phantomjs&quot;,
                        &quot;border&quot;: {
                            &quot;top&quot;: &quot;1cm&quot;,            // default is 0, units: mm, cm, in, px
                            &quot;right&quot;: &quot;2cm&quot;,
                            &quot;bottom&quot;: &quot;1cm&quot;,
                            &quot;left&quot;: &quot;1cm&quot;
                        },
                    };
                    pdf.create(data, options).toFile(`temp/${name}.pdf`, function (err, data) {
                        if (err) {
                            console.log(err)
                            res.send(&quot;cannot create pdf&quot;);
                        } else {
                            var file = `temp/${name}.pdf`;
                            fs.readFile(file, function (err, data) {
                                res.contentType(&quot;application/pdf&quot;);
                                res.send(data);
                            });
                        }
                    });
                }
            });
        } catch (e) {
            console.log(e)
            return res.status(500).json({ status: &quot;error&quot;, data: &quot;internal server error&quot; });
        }
    },
  </code></pre>