2

I keep having issues when trying to save the settings for Enupal Snapshot at Craft Nitro, enter image description here

Below is the error message I found at the log file,

[enupal\snapshot\Snapshot::error] Something went wrong when creating the PDF file: The exit status code '127' says something went wrong:
stderr: "sh: /usr/local/bin/wkhtmltopdf: not found

[error][enupal\snapshot\Snapshot::error] Something went wrong when creating the Image file: The exit status code '127' says something went wrong:
stderr: "sh: /usr/local/bin/wkhtmltoimage: not found

I have installed the wkhtmltopdf at Ubuntu 20.04 based on the documentation and get the path using 'which wkhtmltopdf', 'which wkhtmltoimage' enter image description here

I have also enabled the Public URL for the asset, enter image description here

How can I fix this?

I'm using Nitro 2 at Window 10 x64, below are my system details,

Ubuntu 20
PHP version 7.4.16
OS version  Linux 5.4.72-microsoft-standard-WSL2
Craft Pro 3.6.13
Enupal Snapshot 1.2.8
2
  • I'll try to install snapshot on nitro2. I'll back to you soon
    – Andre L.
    Commented Jul 14, 2021 at 9:11
  • @AndreL. Thanks.
    – Lee
    Commented Jul 15, 2021 at 2:25

3 Answers 3

3

The issue is because wkhtmltopdf wasn't installed on the right server. I need to install the package inside the nitro server by ssh into the root of the container.

Here is the steps,

nitro ssh --root 
apk add  --no-cache --repository  http://dl-cdn.alpinelinux.org/alpine/v3.10/main/ wkhtmltopdf=0.12.6-r0

wkhtmltopdf=0.12.6-r0 is the version.

You might need to update your package if you fail to install,

apk update

After your installation, you should be able to get the path,

which wkhtmltopdf 
which wkhtmltoimage

In case you want to check your version, you can run the below command after getting your path,

/usr/bin/wkhtmltopdf --version

Here is the reference, https://stackoverflow.com/questions/59026248/how-to-install-wkhtmltopdf-on-docker-ruby-2-5-1-alpine-linux

1
  • 1
    Keep in mind that this will get blown away if you ever update the container Commented Jul 31, 2021 at 13:07
1

Was the value you got from which whtmlopdf $whtmlopdf? Return code 127 is

Value 127 is returned by /bin/sh when the given command is not found within your PATH system variable and it is not a built-in shell command. In other words, the system doesn't understand your command, because it doesn't know where to find the binary you're trying to call. https://stackoverflow.com/questions/1763156/127-return-code-from

So I'm thinking it has something to do with that. I had a few issues getting it setup so am happy to try and help.

1
  • Basically the system not able to detect the path for whtmlopdf, which I have installed
    – Lee
    Commented Jul 15, 2021 at 2:24
1

To install Enupal Snapshot on Nitro 2 (could be the same for Alpine Linux distros)

  • Login to nitro via ssh as root: nitro ssh your_nitro_site_name --root
  • Run the following command to install wkhtmltopdf and dependencies
apk --update --no-cache add \
   wkhtmltopdf \
    libgcc \
    libstdc++ \
    musl \
    qt5-qtbase \
    qt5-qtbase-x11 \
    qt5-qtsvg \
    qt5-qtwebkit \
    ttf-freefont \
    ttf-dejavu \
    ttf-droid \
    ttf-liberation \
    fontconfig \
    so:libQt5Core.so.5 \
    so:libQt5Gui.so.5 \
    so:libQt5Network.so.5 \
    so:libQt5PrintSupport.so.5 \
    so:libQt5Svg.so.5 \
    so:libQt5WebKit.so.5\
    so:libQt5WebKitWidgets.so.5\
    so:libQt5Widgets.so.5\
    so:libc.musl-x86_64.so.1\
    so:libgcc_s.so.1\
    so:libstdc++.so.6
  • On your Craft CMS dashboard go to the Enupal Snapshot settings and save the following settings:

Absolute Binary Path of wkhtmltopdf libRequired: /usr/bin/wkhtmltopdf

Absolute Binary Path of wkhtmltoimage lib /usr/bin/wkhtmltoimage

  • Save your Settings

This was an issue raised on Github -> #43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.