You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FROM node:20-alpine AS dependencies
RUN corepack enable
WORKDIR /app
COPY package.json ./
COPY yarn.lock ./
RUN yarn --immutable
FROM node:20-alpine AS builder
RUN corepack enable
WORKDIR /app
COPY --from=dependencies /app/package.json ./
COPY --from=dependencies /app/.pnp.cjs ./
COPY --from=dependencies /app/.yarn ./.yarn
COPY --from=dependencies /app/yarn.lock ./
COPY ./src ./src
RUN yarn build
FROM node:20-alpine AS runner
RUN corepack enable
WORKDIR /app
COPY --from=builder /app/build ./
COPY --from=dependencies /app/.pnp.cjs ./
COPY --from=dependencies /app/.yarn ./.yarn
ENTRYPOINT ["node", "src/testCode.js"]
fails with error
> [builder 9/9] RUN yarn build:
1.157 ! Corepack is about to download https://repo.yarnpkg.com/4.4.1/packages/yarnpkg-cli/bin/yarn.js
3.298 /app/.pnp.cjs:5676
3.298 throw firstError;
3.298 ^
3.298
3.298 Error: Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.
3.298
3.298 Missing package: typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=379a07
3.298 Expected package location: /root/.yarn/berry/cache/typescript-patch-fe43cd9db9-10c0.zip/node_modules/typescript/
3.298
3.298 at require$$0.Module._resolveFilename (/app/.pnp.cjs:5675:13)
3.298 at Module._load (node:internal/modules/cjs/loader:1051:27)
3.298 at require$$0.Module._load (/app/.pnp.cjs:5566:31)
3.298 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
3.298 at node:internal/main/run_main_module:28:49
4.967 Error: Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.
4.967
4.967 Missing package: typescript@patch:typescript
Environment
System:
OS: Linux 5.15 Alpine Linux
CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
Binaries:
Node: 20.17.0 - /tmp/xfs-19d7b165/node
Yarn: 4.4.1 - /tmp/xfs-19d7b165/yarn
npm: 10.8.2 - /usr/local/bin/npm
Additional context
No response
The text was updated successfully, but these errors were encountered:
It seems that with Yarn 4, we also need to copy the cache folder from dependencies(COPY --from=dependencies /root/.yarn /root/.yarn in this case).
The main issue here is the lack of proper documentation, there aren’t many guides available for the new yarn version, and most of the existing ones are outdated, simple upgrade take almost a complete day of trial/error for me
Perhaps a new entry in the documentation could be helpful ( e.g a guide on how to migrate yarn 1 dockerfiles to yarn 4 in https://yarnpkg.com/migration/guide )
e.g also for this one #6489 (comment) , I didnt find any document about not using YARN_COMMAND in your envs ( this wasnt a problem in yarn v1 )
Self-service
Describe the bug
a very simple packge.json with
and a dockerfile
fails with error
yarn build
outside docker works fine !To reproduce
Clone https://github.com/uchar/yarnbugs/tree/multistage_typescript_patch_error move to branch
multistage_typescript_patch_error
Then run
you will see the error
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: