Help us understand the problem. What is going on with this article?

npm install very slow in container

More than 5 years have passed since last update.

Doing npm install on a container when building image is notoriously slow. It should be slow because it's on a virtual machine (I was using boot2docker), but it's like heaven and earth when compared to npm install on host machine. Try using npm install --verbose, on host machine you won't be able to read the log because it scrolls so fast. While on a container, you can see it's stopping every now and then -- especially when creating a .cache.json file.

Try this before npm install:

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

eg:

# Dockerfile
RUN npm config set registry http://registry.npmjs.org/ && npm install --no-optional --verbose

It works magic for me! :shipit:

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした