I’m encountering an issue while trying to compose Docker instances in my local environment. When I run the docker-compose up command, I get the following error:
> 2024-12-10 12:46:12 > laredo-backend-api@0.0.1 start:docker:dev
> 2024-12-10 12:46:12 > npm install && npm run start:prisma && npm run
> start:dev 2024-12-10 12:46:12 2024-12-10 12:46:16 2024-12-10
> 12:46:16 added 1 package, and audited 1011 packages in 3s 2024-12-10
> 12:46:16 2024-12-10 12:46:16 134 packages are looking for funding
> 2024-12-10 12:46:16 run `npm fund` for details 2024-12-10 12:46:16
> 2024-12-10 12:46:16 6 vulnerabilities (1 low, 2 moderate, 3 high)
> 2024-12-10 12:46:16 2024-12-10 12:46:16 To address issues that do not
> require attention, run: 2024-12-10 12:46:16 npm audit fix 2024-12-10
> 12:46:16 2024-12-10 12:46:16 To address all issues, run: 2024-12-10
> 12:46:16 npm audit fix --force 2024-12-10 12:46:16 2024-12-10
> 12:46:16 Run `npm audit` for details. 2024-12-10 12:46:16 2024-12-10
> 12:46:16 > laredo-backend-api@0.0.1 start:prisma 2024-12-10 12:46:16 >
> prisma migrate deploy 2024-12-10 12:46:16 2024-12-10 12:46:22
> Environment variables loaded from .env 2024-12-10 12:46:22 Prisma
> schema loaded from prisma/schema.prisma 2024-12-10 12:46:22 Datasource
> "db": PostgreSQL database "laredo", schema "public" at "postgres:5432"
> 2024-12-10 12:46:22 2024-12-10 12:46:17 prisma:warn Prisma failed to
> detect the libssl/openssl version to use, and may not work as
> expected. Defaulting to "openssl-1.1.x". 2024-12-10 12:46:17 Please
> manually install OpenSSL and try installing Prisma again. 2024-12-10
> 12:46:22 prisma:warn Prisma failed to detect the libssl/openssl
> version to use, and may not work as expected. Defaulting to
> "openssl-1.1.x". 2024-12-10 12:46:22 Please manually install OpenSSL
> and try installing Prisma again. 2024-12-10 12:46:22 Error: Could not
> parse schema engine response: SyntaxError: Unexpected token 'E',
> "Error load"... is not valid JSON 2024-12-10 12:46:22 npm notice
> 2024-12-10 12:46:22 npm notice New minor version of npm available!
> 10.8.2 -> 10.9.2 2024-12-10 12:46:22 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.2 2024-12-10 12:46:22
> npm notice To update run: npm install -g npm@10.9.2 2024-12-10
> 12:46:22 npm notice
I've done some googling and ran the following commands in order to fix this:
brew install openssl@3
rm -rf node_modules && npm i
npx prisma generate
npx prisma migrate --dev
The follwoing is my prisma generator
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl", "darwin-arm64", "linux-musl-openssl-3.0.x"]
}
Docker file
FROM node:20-alpine AS builder
USER root
RUN npm i -g npm@~9.3.1
WORKDIR /usr/app
COPY . ./
RUN chmod +x ./entrypoint.sh
RUN npm ci
RUN npm run build
FROM node:20-alpine AS deployment
# added this to try to fix but still broken
RUN set -ex; \
apk update; \
apk add --no-cache \
openssl
COPY --from=builder --chown=node:node /usr/app /usr/app
USER node
CMD ["sh"]
Any pointers are appreciated thanks!
Thanks for all the pointers everyone the thing that ended up working however was adding FROM node:20-alpine3.17
to the docker and docker compose files. As shown in this comment https://github.com/nodejs/docker-node/issues/2175#issuecomment-2530559047