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:
> email@example.com build /src/MyApp/ClientApp
> ng build "--prod"
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! firstname.lastname@example.org build: `ng build "--prod"`
npm ERR! Exit status 137
npm ERR! Failed at the email@example.com 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".
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.