Sometimes npm install commands fails because memory size is small.
In that case, if we can resolve the issue my using some hard disk space as a swap memory.
We can find more details about swap memory here.
https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-swap-what-is.html