As of my last knowledge update in September 2021, the ghostscript package is not available as a pre-built binary for the Node.js 16.x Alpine Linux environment, which is commonly used in Docker containers. The absence of a pre-built binary is the reason why you are encountering the "no install candidate" error when trying to install ghostscript in a Node.js 16 Docker container.

To resolve this issue, you can consider using a different base image for your Docker container that includes ghostscript or manually installing ghostscript using a different package manager.

Option 1: Use a Different Base Image Instead of using the default Node.js 16.x Alpine image, you can try using a different base image that includes ghostscript. For example, you can use the node official image that is based on Debian:

Dockerfile
FROM node:16 # Install ghostscript RUN apt-get update && apt-get install -y ghostscript # Copy and install your Node.js application COPY package.json package-lock.json ./ RUN npm install COPY . . CMD ["node", "app.js"]

Option 2: Manual Installation If you want to stick with the Alpine-based Node.js 16 image, you can try manually installing ghostscript using the Alpine package manager apk:

Dockerfile
FROM node:16-alpine # Install ghostscript manually using apk RUN apk update && apk add --no-cache ghostscript # Copy and install your Node.js application COPY package.json package-lock.json ./ RUN npm install COPY . . CMD ["node", "app.js"]

Please note that the availability of ghostscript might vary depending on the base image you choose, and it's essential to verify the package availability and compatibility with your specific use case.

Additionally, keep in mind that the package availability or Docker images might change over time, so it's a good idea to check for updates and refer to the official package repositories or Docker Hub for the latest information on available images and packages.

Have questions or queries?
Get in Touch