If you are building a docker image and have commands to run npm update or npm install command previously with no errors if you try to run the same build again you might run this error as there is an update to how Node works starting with version 15.
With Node version 15 and higher a WORKDIR needs to be specified else it would try to run the root directory. A quick fix is to create a WORKDIR in your Dockerfile.
FROM node:alpine
#Install some dependencies
WORKDIR /usr/app
COPY ./ ./
# Install base dependencies
RUN apk add git
RUN npm update
RUN npm install sfdx-cli -g
It’s not clear how to install the dependencies and updates mentioned here.
Node requires that a WORKDIR be added to the image. This is where the directory would store all the installs/dependencies.
Thanks so much!