-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Using gcr.io/distroless/nodejs20-debian12 image but node and npm commands not found #1637
Comments
We intentionally don't include npx: see fdd0b48 for removal. node should be available, but maybe not on the path in debug. Try running it directly |
@loosebazooka is there any way to install this manually? |
you could drop it in the container using a build of some kind. Would |
You're getting this error because the node binary is at
If you still want to have Take this example, it'll install npm into local node_modules in FROM node:20-bookworm-slim AS builder
WORKDIR /app
RUN npm install --save npm
FROM gcr.io/distroless/nodejs20-debian12:debug
WORKDIR /app
ENV PATH /nodejs/bin:$PATH
COPY --from=builder /app /app Then run it like this ❯ docker run --rm -it --entrypoint sh distroless-node-with-npm
/app # node -v
v20.18.0
/app # node node_modules/.bin/npm -v
10.9.0
/app # node node_modules/.bin/npx -v
10.9.0 |
Though, should note that it doesn't work flawlessly, as it looks like the child process node functions expects to find |
I'm trying to run my Node.js application using the
gcr.io/distroless/nodejs20-debian12:debug
image. However, when I execute my application, I get the following error:I am using the npx command in my docker-compose file, but it seems like node and npm are not installed in the container. Why are the node and npm commands not found in the gcr.io/distroless/nodejs20-debian12:debug image?
How can I run npx commands using a distroless Node.js image?
It seems like the Node.js runtime is not available. Here are the details when I run the container interactively:
The text was updated successfully, but these errors were encountered: