1. NPM error status 137 when building a Docker image
Just recently I tried to build a Docker image for the Angular application. And, I had behavior where I was able to build one on my laptop working on Windows, but had the following error on the Windows server:
> client-app@0.0.1 build /src/MyApp/ClientApp
> ng build "--prod"
Killed
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! client-app@0.0.1 build: `ng build "--prod"`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the client-app@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-11-25T011_26_21_40Z-debug.log
So, my docker build that was trying to execute npm build crashed with error status 137. It also pointed out that: "This is probably not a problem with npm. There is likely additional logging output above".
2. Solution
So, I tried to understand what causes the issue and after a bit of research, I found out that this specific npm error status usually means that Docker is going out of memory. So, when this happens, the Linux kernel just kills the process.
So, I checked my Docker configuration and I saw that it's limited to 2GB of RAM. After increasing this to 4.5GB, it worked like a charm.
To increase the amount of RAM memory allocated to Docker on a Windows machine, right-click the Docker icon in the system tray, go to Settings, then Advanced and you can configure it there.