Fatal error: Newspace:: rebalance allocation failed – process out of memory (memory overflow)

problem: when adding some project files, run the project with NPM run dev, the project run error as shown below:

reason: project running out of memory

solution: find node_modules> .bin> Webpack-dev-server. CMD file, add –max-old-space-size=8192
original file:

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\..\webpack-dev-server\bin\webpack-dev-server.js" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  "%~dp0\..\webpack-dev-server\bin\webpack-dev-server.js" %*
)

is modified to:

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\..\webpack-dev-server\bin\webpack-dev-server.js" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  --max-old-space-size=8192  "%~dp0\..\webpack-dev-server\bin\webpack-dev-server.js" %*
)

Read More: