title: npm - How to set max-old-space-size in npm
body: <p>I am getting the below error while building the angular project,</p>
  
  <p>CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory</p>
  
  <p>I have seen somewhere that configuring max-old-space-size in npm will solve the issue. But I don't know how to set it. I am using Windows OS &amp; there are two npm files inside the nodejs installation folder (C:\Program Files\nodejs), npm &amp; npm.cmd. First line inside the npm.cmd file is "Created by npm, please don't edit manually". So I am not supposed to edit this file &amp; I have to configure max-old-space-size inside npm file. But I don't where in this file I have to configure it. My npm file looks like below,</p>
  
  <pre><code>#!/bin/sh
  (set -o igncr) 2&gt;/dev/null &amp;&amp; set -o igncr; # cygwin encoding fix
  
  basedir=`dirname "$0"`
  
  case `uname` in
      *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
  esac
  
  NODE_EXE="$basedir/node.exe"
  if ! [ -x "$NODE_EXE" ]; then
    NODE_EXE=node
  fi
  
  NPM_CLI_JS="$basedir/node_modules/npm/bin/npm-cli.js"
  
  case `uname` in
    *MINGW*)
      NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
      NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"
      if [ -f "$NPM_PREFIX_NPM_CLI_JS" ]; then
        NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS"
      fi
      ;;
    *CYGWIN*)
      NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
      NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"
      if [ -f "$NPM_PREFIX_NPM_CLI_JS" ]; then
        NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS"
      fi
      ;;
  esac
  
  "$NODE_EXE" "$NPM_CLI_JS" "$@"
  </code></pre>