简体   繁体   English

运行 npm ci 挂在 docker 构建 ubuntu

[英]run npm ci hangs on docker build ubuntu

I'm trying to build a docker file for an ionic project, on ubuntu virtualbox.我正在尝试在 ubuntu virtualbox 上为离子项目构建 docker 文件。 Here's the dockerfile:这是 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.我的问题是构建卡在第 4 步( RUN npm --verbose ci )它开始下载一些包,但它在某个时候挂起。 I tried different solution:我尝试了不同的解决方案:

npm clean cache
npm config set registry http://registry.npmjs.org/

removing package-lock.json删除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.继续尝试,直到它下载所有软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM