Strapi V5 - Could not load the "sharp" module
nazisagit
HOBBYOP

a month ago

Could not load js config file /app/node_modules/@strapi/upload/dist/server/index.js: Could not load the "sharp" module using the linux-x64 runtime

Dockerfile.production

FROM node:20.19.5-bookworm AS build
WORKDIR /app

# Install dependencies
COPY package.json ./
RUN npm install --package-lock-only
RUN npm ci

# Build
COPY . .
RUN npm run build

# Remove dev dependencies after build
RUN npm prune --omit=dev


FROM node:20.19.5-bookworm AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=1337

# Copy the built app with pruned dependencies
COPY --from=build /app /app

EXPOSE 1337
CMD ["npm", "run", "start"]

package.json

{
  "name": "padas",
  "version": "0.1.0",
  "private": true,
  "description": "A Strapi application",
  "scripts": {
    "build": "strapi build",
    "console": "strapi console",
    "deploy": "strapi deploy",
    "dev": "strapi develop",
    "develop": "strapi develop",
    "seed:example": "node ./scripts/seed.js",
    "start": "strapi start",
    "strapi": "strapi",
    "upgrade": "npx @strapi/upgrade latest",
    "upgrade:dry": "npx @strapi/upgrade latest --dry"
  },
  "dependencies": {
    "@strapi/plugin-cloud": "5.29.0",
    "@strapi/plugin-users-permissions": "5.29.0",
    "@strapi/strapi": "5.29.0",
    "fs-extra": "^10.0.0",
    "mime-types": "^2.1.27",
    "pg": "8.8.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "^6.0.0",
    "strapi-phone-validator-5": "^1.0.0",
    "strapi-plugin-multi-select": "^2.1.1",
    "styled-components": "^6.0.0"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "typescript": "^5"
  },
  "engines": {
    "node": ">=20.19.5 <=22.x.x",
    "npm": ">=10.8.2"
  },
  "strapi": {
    "uuid": "3a01cbbc-166a-4aec-a39d-e4473c4d9868",
    "installId": "46020a16f167cfd631b082beec7fb7e32ac8feb94718e517127db12bfa367197"
  }
}
$10 Bounty

1 Replies

Railway
BOT

a month ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Loading...