Npm install not working in Alpine Linux Docker container

62 Views Asked by At

I am in an Alpine Linux Docker container and when I try to run npm install, npm hangs and kills itself! This is what the last line in the npm log looks like: https://imgur.com/T8KIojJ

Things I've tried:

  • clearing the cache,
  • excluding optional dependencies, and
  • there is no package-lock.json in the folder.
1

There are 1 best solutions below

0
Andrew On

It seems like your Docker container might not have enough memory or CPU resources to complete the npm install command. Possible solutions

  1. Allocate More Memory and CPU: When you run your Docker container, you can specify the amount of memory and CPU it can use with the -m and --cpus flags. For example:
docker run -m 512m --cpus 2.0 your-image-name
  1. The "Killed" message you're seeing is typically a sign that the npm process is being terminated by the system's Out-of-Memory (OOM) Killer. more context here

You might need to paste more information about your yml configuration