Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prince command not found in container #34

Open
dingbo8128 opened this issue Dec 28, 2022 · 9 comments
Open

prince command not found in container #34

dingbo8128 opened this issue Dec 28, 2022 · 9 comments

Comments

@dingbo8128
Copy link

No next link found!
........

/usr/local/bin/prince: exec: line 3: /usr/local/lib/prince/bin/prince: not found

@adrianbienias
Copy link

Same here.

After executing:

docker run --rm -it --init \
  -v $(pwd)/pdf:/app/pdf \
  openbayes/docusaurus-prince-pdf \
  -u https://docusaurus.io/docs/

I'm getting:

...
Got link: https://docusaurus.io/docs/migration/manual
Got link: https://docusaurus.io/docs/migration/versioned-sites
Got link: https://docusaurus.io/docs/migration/translated-sites
No next link found!
Writing buffer (52 links) to ./pdf/docusaurus.io-docs.txt
Generating PDF ./pdf/docusaurus.io-docs.pdf
Executing command: prince --no-warn-css --style=/app/print.css --input-list=./pdf/docusaurus.io-docs.txt -o ./pdf/docusaurus.io-docs.pdf 
Error: Command failed: prince --no-warn-css --style=/app/print.css --input-list=./pdf/docusaurus.io-docs.txt -o ./pdf/docusaurus.io-docs.pdf 
/usr/local/bin/prince: exec: line 3: /usr/local/lib/prince/bin/prince: not found

@hazza203
Copy link

Same here

@qarlosalberto
Copy link

Same

@kingchun1991
Copy link

Does anyone using old verison is working?

@kingchun1991
Copy link

Hey guys,

Please use 1.1.1 instead of latest version of the image

 docker run --rm -it --init \
  -v $(pwd)/pdf:/app/pdf \
  -v $(pwd)/fonts:/root/.fonts \
  openbayes/docusaurus-prince-pdf:1.1.1 \
  -u https://docusaurus.io/docs/

phantomk added a commit to phantomk/docusaurus-prince-pdf that referenced this issue Apr 6, 2023
phantomk added a commit to phantomk/docusaurus-prince-pdf that referenced this issue Apr 6, 2023
@ericroy
Copy link

ericroy commented Jul 5, 2023

I'm using 1.1.1, but still getting this error.

Output:

docker run --rm -it --init -v "D:/code/redacted/build:/app/pdf:rw" openbayes/docusaurus-prince-pdf:1.1.1 -u http://host.docker.internal:4000
(node:7) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Got link: http://host.docker.internal:4000/docs
Got link: http://host.docker.internal:4000/docs/page1
Got link: http://host.docker.internal:4000/docs/page2
No next link found!
Writing buffer (3 links) to ./pdf/host.docker.internal.txt
Generating PDF ./pdf/host.docker.internal.pdf
Executing command: prince --no-warn-css --style=/app/print.css --input-list=./pdf/host.docker.internal.txt -o ./pdf/host.docker.internal.pdf
Error: Command failed: prince --no-warn-css --style=/app/print.css --input-list=./pdf/host.docker.internal.txt -o ./pdf/host.docker.internal.pdf 
/usr/local/bin/prince: exec: line 3: /usr/local/lib/prince/bin/prince: not found

    at ChildProcess.exithandler (node:child_process:398:12)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:709:12) {
  code: 127,
  killed: false,
  signal: null,
  cmd: 'prince --no-warn-css --style=/app/print.css --input-list=./pdf/host.docker.internal.txt -o ./pdf/host.docker.internal.pdf '
}

@cmsong-shina
Copy link

Due to downloading an incompatible version of PrinceXML and a broken dependency, it is not working.

I'm not sure if I should submit a merge request, but the issue can be easily resolved by editing the Dockerfile and building it.

To resolve the problem, follow these steps:

  1. Clone the repository.
  2. Build the Docker image using the provided Dockerfile:

Note that below hard-coded Dockerfile only works on x86_64 machine.

Dockerfile

FROM node:18.4.0-alpine3.15

ENV NODE_ENV=production

WORKDIR /app

COPY . /app

VOLUME /app

ARG TARGETARCH

# https://www.princexml.com/latest/
# https://www.princexml.com/download/prince-14.2-alpine3.13-x86_64.tar.gz -o prince.tar.gz
ARG PRINCE_VER=20220510
ARG DISTRO=linux-generic

RUN echo "Building for $TARGETARCH"

RUN yarn --frozen-lockfile && \
    yarn cache clean


# dependency
RUN apk add  \
    giflib \
    tiff \
    libjpeg \
    libwebp \
    libxml2 \
    libxml2 \
    lcms2 \
    libcrypto3 \
    curl

RUN prince_arch=$([ "$TARGETARCH" == "arm64" ] && echo "aarch64-musl" || echo "x86_64") \
    && curl https://www.princexml.com/download/prince-15.1-alpine3.14-x86_64.tar.gz -o prince.tar.gz \
    && mkdir prince \
    && tar -zxvf prince.tar.gz -C prince --strip-components=1 \
    && rm prince.tar.gz \
    && cd prince \
    && yes "" | ./install.sh

RUN apk add --no-cache \
    terminus-font \
    ttf-inconsolata \
    ttf-dejavu \
    font-croscore \
    font-noto \
    font-noto-extra \
    --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community/

# Install fonts
RUN apk add --no-cache msttcorefonts-installer fontconfig && \
    update-ms-fonts && \
    fc-cache -f && rm -rf /var/cache/*

ENTRYPOINT [ "node", "index.js" ]

Build as dpp

docker build -t dpp .

Then it sould works.

Windows

$outputPath = $pwd.Path.Replace("`n", "").Replace("`r", "") + "/pdf"; `
docker run --rm -it --init `
  -v $outputPath\:/app/pdf `
  dpp `
  -u "https://docusaurus.io/docs/cli"

@sparanoid
Copy link
Contributor

sparanoid commented Aug 29, 2023

I've updated the prince version. Please let me know if it works for you.

@roddc
Copy link

roddc commented Sep 28, 2023

I've updated the prince version. Please let me know if it works for you.

The problem still exists
openbayes/docusaurus-prince-pdf latest fc66f36e7984 4 weeks ago 586MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants