Skip to content

Using node LTS leads to error during docker run #2095

Open
@shuo-move

Description

@shuo-move

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:

  1. run command docker build -t test-image . and image should be built without error
  2. run command docker run -p 3000:3000 test-image and it leads to error
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.

How often does it reproduce? Is there a required condition?

It is 100% reproducible with node v20.14.0 (latest LTS). After pinned node version to 18.20.3, the issue is gone.

I've tried lower version of node 20 like 20.9.0 and it has the same issue.

FROM node:18.20.3 as base

What is the expected behavior? Why is that the expected behavior?

The docker run command should not error out.

What do you see instead?

running command docker run -p 3000:3000 test-image leads to error:

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.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions