Overview
Step fails when running npm test with a similar error:
Message: Failed to read environment variable exporting file:/codefresh/volume/asdfg/env_vars_to_export
Caused by: Failed to read file /codefresh/volume/asdfg/env_vars_to_export
Details
This error can mean multiple things, but the most common reason is that the build was killed due to reaching the memory limit. Without specifying, npm will try to use as much memory as it can. You can limit the memory usage of these commands by following the steps below.
-
Check the size (Small, Medium, Large, etc.) of the build to see the memory limit for the build.
- In the YAML, replace
npm test
withnode --max-old-space-size=3072 ./node_modules/.bin/jest
. - where
--max-old-space-size=
value is smaller than the memory limit for the build size in MB - Re-run the build, and it should not be killed due to hitting the memory limit.