run npm ci hangs on docker build ubuntu


I’m trying to build a docker file for an ionic project, on ubuntu virtualbox. Here’s the dockerfile:

# Build
FROM beevelop/ionic AS ionic
# Create the application directory
WORKDIR /usr/src/app
# Install the application dependencies
# We can use wildcard to ensure both package.json AND package-lock.json are considered
# where available (npm@5+)
COPY package*.json ./
RUN npm --verbose ci
# Bundle app source
COPY . .
RUN ionic build

## Run 
FROM nginx:alpine
#COPY www /usr/share/nginx/html
COPY --from=ionic /usr/src/app/www /usr/share/nginx/html

My problem is that the build gets stuck on step 4 (RUN npm --verbose ci) It starts downloading some packages, but then it hangs at some point.
I tried different solution:

npm clean cache
npm config set registry

removing package-lock.json

But nothing works, any help will be greatly apprecited. Thanks in advance


To whoever experienced this problem, it was to due to internet connection. Keep trying until it downloads all the packages.

Answered By – Fahima Mokhtari

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published