title: npm run build in php Laravel hang or exit
body: <p>I'm trying to deploy a Laravel project to my server with this specs:</p>
  
  <ul>
  <li>OS: CentOS Linux release 7.8.2003</li>
  <li>Nodejs: 13.14.0</li>
  <li>npm: 6.14.5</li>
  <li>1 CPU</li>
  <li>4GB Ram</li>
  </ul>
  
  <p>Everything was fine but a step, as I use ReactJS with Laravel I have to run npm run dev to let webpack build my assets files. (This is just the step to build the view, it run fine on my local machine and my friend's, with the different of os, MacOS and Ubuntu).</p>
  
  <p>But when I run <code>npm run dev</code> the system either hang like this</p>
  
  <pre><code>[spyets@vultr current]$ npm run dev
  
  &gt; @ dev /home/spyets/public_html/yamlive/releases/3
  &gt; npm run development
  
  
  &gt; @ development /home/spyets/public_html/yamlive/releases/3
  &gt; cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
  
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wMmEa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wMmEa.jpg" alt="enter image description here"></a></p>
  
  <p>or show this error</p>
  
  <pre><code>Exit Code: 254 (Unknown error)                                                    
  
    Host Name: development                                                            
  
    ================                                                                  
    bash: fork: retry: No child processes                                             
    bash: fork: retry: No child processes                                             
    bash: fork: retry: No child processes                                             
    bash: fork: retry: No child processes                                             
    bash: fork: Resource temporarily unavailable 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/312gk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/312gk.jpg" alt="enter image description here"></a></p>
  
  <p>I don't know if this give you more information, I run a vtop (a terminal management tool?) and every time I run the <code>npm run dev</code> command, <code>vtop</code> just crashed</p>
  
  <p><strong>What I tried</strong>:</p>
  
  <ol>
  <li>reboot the server</li>
  <li>reinstall nodejs ( I install nodejs directly with <code>yum</code> not using <code>nvm</code> )</li>
  <li>upgrade nodejs from 12.20.2 to 13.14.0 ( as it currently in 13.14.0 )</li>
  </ol>
  
  <p>I'm new to Centos and deployment. </p>
  
  <p><strong>Edit</strong></p>
  
  <ul>
  <li>I also tried to make swapfile and add 3GB of swap</li>
  <li>I tried remove node_modules and reinstall with npm install multiple times</li>
  <li>Running both <code>npm run dev</code> and <code>npm run prod</code> resulted in failed or crash</li>
  </ul>