-3

Why was /usr/local/lib the defaut local packages destination directory in NodeJS docker image ?

FROM node:24-alpine

WORKDIR app/

COPY package.json yarn.lock ./
RUN corepack enable \
    && corepack prepare yarn@stable --activate \
    && yarn install --immutable \
    && yarn cache clean
RUN ls -l node_modules

You get a "File or directory was not Found" error

A sample Gist project:

4
  • Check it out from container's shell : find / -name node_modules returns /usr/local/lib/node_modules Commented Nov 1 at 11:33
  • I can't reproduce, local modules get installed in /node_modules as expected. /usr/local/lib/node_modules exists and just contains npm. Commented Nov 1 at 11:50
  • what's found in /node_modules ? Commented Nov 1 at 13:54
  • The modules that are mentioned in package.json/yarn.lock Commented Nov 1 at 14:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.