Skip to content

Permission denied on debian docker image and cannot found npm #3833

@seepine

Description

@seepine

Runtime

Dockerfile

FROM debian:trixie-slim
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        curl \
        git \
        nano \
        iputils-ping \
        ca-certificates \
        golang \
        gh \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
WORKDIR /root

docker-compose.yml

services:
  debian-template:
    build:
      context: .
      dockerfile: Dockerfile
    image: debian-template:latest
    volumes:
      - .data:/root
    command: ["/bin/bash", "-lc", "echo hello && tail -f /dev/null"]

docker exec -it in container

root@dbfb2c5d7375:~# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
...

root@dbfb2c5d7375:~# source .bashrc

And install got error

root@dbfb2c5d7375:~# nvm install 24
Downloading and installing node v24.15.0...
Downloading https://nodejs.org/dist/v24.15.0/node-v24.15.0-linux-arm64.tar.gz...
##########################################################               100.0%
Computing checksum with sha256sum
Checksums matched!
tar: bin/npm: Cannot open: Permission denied
tar: bin/npx: Cannot open: Permission denied
tar: bin/corepack: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
Now using node v24.15.0
Installing npm...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
100  3755  100  3755    0     0    728      0  0:00:05  0:00:05 --:--:--  2791
failed to get tarball url for npm/0.2.19

And cannot found npm

root@dbfb2c5d7375:~# nvm use 24
Now using node v24.15.0

root@dbfb2c5d7375:~# node -v
v24.15.0

root@dbfb2c5d7375:~# npm -v
bash: npm: command not found
root@dbfb2c5d7375:~# which node
/root/.nvm/versions/node/v24.15.0/bin/node
root@dbfb2c5d7375:~# which npm 
root@dbfb2c5d7375:~# which npx 

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs followupWe need some info or action from whoever filed this issue/PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions