Skip to content

Instantly share code, notes, and snippets.

@valex91
Last active October 21, 2021 12:48
Show Gist options
  • Save valex91/8402175bba1c9c43bc666c249ec1fd83 to your computer and use it in GitHub Desktop.
Save valex91/8402175bba1c9c43bc666c249ec1fd83 to your computer and use it in GitHub Desktop.
set into a persistent manner the ENV variable for incresing the heap of nodejs. Work with windows if you got any shell emulator and macOS
#!/bin/bash
if [ -n "$1" ];
then {
setx NODE_OPTIONS "--max-old-space-size=$1"
} || {
echo "export NODE_OPTIONS='--max-old-space-size=$1'" >> "$HOME/.bash_profile"
}
echo "successfully set the memory limit to $1MB";
else
echo "You need to specify a limit by passing an argument to the script ./increaseNodeSize.sh <amount>";
fi
read -p 'Press enter to continue'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment