Docker build form cache

Hi Team, I am trying to build docker image for node with cache. but its not working.

here is the Docker file

FROM node:16.20.2 
WORKDIR /app
ADD . .
RUN --mount=type=cache,target=/app/.npm \
      npm set cache /app/.npm && \
      npm install --force --cache=true
RUN npm run build
CMD ["npm", "start"]

I tried to change one module versions which was in package.json file. to verify that rebuild image. but not working all modules again started installing.

How to achieve that? any ideas, suggestions and support.

Thanks.