Same docker container behave differently for same code? how it is possible?

I’am using docker container, ‘node:16.3.0-alpine’, I am building angular(compiling) and coping it to nginx:alpine’.

FROM node:16.3.0-alpine As build

# set working directory
WORKDIR /usr/local/app

# add .bin to $PATH
ENV PATH /usr/local/app/node_modules/.bin:$PATH
COPY package.json decorate-angular-cli.js .npmrc  /usr/local/app/

RUN npm install

# add app
COPY . /usr/local/app

# start app
RUN npm run build

FROM nginx:alpine
COPY --from=build /....   /usr/share/nginx/html

# Expose port 80
EXPOSE 80:80

when I build this on local mac, it work fine, code gets compiled and this build code(compiled code)moves to nginx container smoothly. now issue comes when put this docker in bitbucket pipe line, here it failed to build and give, issues, i.e module not found etc.
Question is why it was not complaining when I build it on local machine? is docker container dependent on environment ?