Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot bypass "Corepack is about to download" prompt #550

Open
moltar opened this issue Aug 21, 2024 · 1 comment
Open

Cannot bypass "Corepack is about to download" prompt #550

moltar opened this issue Aug 21, 2024 · 1 comment

Comments

@moltar
Copy link

moltar commented Aug 21, 2024

I'm trying to run corepack inside devcontainers, in a postCreateCommand.

I've upgraded corepack to latest:

npm install --yes --global corepack@latest

Then run:

corepack -v && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack enable

The output I get:

0.29.3
! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-9.7.1.tgz
? Do you want to continue? [Y/n] 

I've tried setting CI too, but also does not work.

Any clues?

@GDWR
Copy link

GDWR commented Aug 23, 2024

I just ran into this, although setting that environment variable worked fine for me.
I did this in the Dockerfile. Below is an example, and my full Docker below that if useful.

FROM #...

# ...

RUN corepack enable && corepack install --global [email protected]
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
Full Dockerfile
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04

# Install node
# https://nodejs.org/en/download/prebuilt-binaries
ARG NODE_VERSION="20.17.0"
ARG NODE_CHECKSUM="a24db3dcd151a52e75965dba04cf1b3cd579ff30d6e0af9da1aede4d0f17486b"
RUN wget --https-only "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" -O /tmp/node.tar.xz && \
    sha256sum /tmp/node.tar.xz | grep "${NODE_CHECKSUM}" && \
    tar -C /usr/local -xf /tmp/node.tar.xz --strip-components=1 --exclude="CHANGELOG.md" --exclude="LICENSE" --exclude="README.md" && \
    rm /tmp/node.tar.xz && \
    corepack enable && \
    corepack install --global [email protected]
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants