EACCES: permission denied, mkdir '/app'

Background

I have built a simple Dockerized Vue/Vite app and connected the GitHub repo to Cloudflare Pages and, up until a few days ago, have had no trouble deploying the app.

Problem

I have made no meaningful changes, but now when I deploy, I get the error: EACCES: permission denied, mkdir '/app'.

|17:57:18.061|Using v2 root directory strategy|
|---|---|
|17:57:18.089|Success: Finished cloning repository files|
|17:57:19.799|Checking for configuration in a wrangler.toml configuration file (BETA)|
|17:57:19.801||
|17:57:19.935|No wrangler.toml file found. Continuing.|
|17:57:20.087|Detected the following tools from environment: [email protected], [email protected]|
|17:57:21.550|Installing project dependencies: pnpm install|
|17:57:22.226| EACCES  EACCES: permission denied, mkdir '/app'|
|17:57:22.227||
|17:57:22.227||
|17:57:22.227||
|17:57:22.268|Error: Exit with error code: 243|
|17:57:22.268|    at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)|
|17:57:22.268|    at Object.onceWrapper (node:events:652:26)|
|17:57:22.268|    at ChildProcess.emit (node:events:537:28)|
|17:57:22.268|    at ChildProcess._handle.onexit (node:internal/child_process:291:12)|
|17:57:22.279|Failed: build command exited with code: 1|
|17:57:23.089|Failed: error occurred while running build command|

Question

Any thoughts on why this issue suddenly appeared and how I can resolve it?

Thanks!

Fixed it. I removed the .npmrc file and specify the pnpm settings

store-dir=/app/.pnpm-store
package-import-method=copy
package-manager-strict=false

explicitly in the Dockerfile:

FROM node:22.2-alpine AS base
WORKDIR /app
COPY package*.json pnpm-lock.yaml /app
RUN apk add --no-cache git \
    && corepack enable \
    && pnpm config set store-dir /app/.pnpm-store \
    && pnpm config set package-import-method copy \
    && pnpm config set package-manager-strict false

FROM base AS prod-deps
RUN pnpm fetch --prod \
    && pnpm install --prefer-offline --ignore-scripts --frozen-lockfile --prod

FROM base AS build
COPY . /app
RUN pnpm fetch \
    && pnpm install --prefer-offline --ignore-scripts --frozen-lockfile \
    && pnpm build

FROM base AS deploy
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist
EXPOSE 8080
CMD ['/bin/sh', 'start_compose.sh']

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.