7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

npm install very slow in container

Last updated at Posted at 2015-05-13

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:

7
8
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?