Open shuo-move opened 4 weeks ago
"packageManager": "yarn@3.5.0"
Looks like you are using a corepack feature without corepack being enabled.
cc @nodejs/corepack
error This project's package.json defines "packageManager": "yarn@3.5.0". However the current global version of Yarn is 1.22.22. Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19. Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
This message is from yarn 1.22.20 and later:
A message will be displayed when Yarn 1.22 notices that the local project has a package.json file referencing a non-1.x Yarn release via the packageManager field. The message will explain that the project is intended to be used with Corepack.
It looks like the Docker images for Node.js 20 include yarn 1.22.22 while the image for Node.js 18 includes an older yarn 1.22.19 (i.e. before the behaviour was changed).
I'll move this issue to https://github.com/nodejs/docker-node.
This error message is by design, it tells you that the package file is from a newer version of yarn. You would need to update yarn in your image.
Version
v20.14.0
Platform
macOS
Subsystem
No response
What steps will reproduce the bug?
Dockerfile: FROM node:lts as base ... RUN yarn install --immutable --immutable-cache ... RUN yarn build ... CMD yarn start
repro steps:
docker build -t test-image .
and image should be built without errordocker run -p 3000:3000 test-image
and it leads to errorPresence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19. Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
FROM node:18.20.3 as base
error This project's package.json defines "packageManager": "yarn@3.5.0". However the current global version of Yarn is 1.22.22.
Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19. Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.