Trying to deploy a react app on AWS EC2. I'm using apache so I got git clone under /var/www/html.
I didn't have any problem when I deployed other projects, but when I npm install
in this new project folder, within some seconds (when it's installing webpack), it just stuck at the same point with the same message.
It stuck there forever and any other command doesn't work. So I have to force quit the terminal. After that, I can't connect on my EC2 instance for 10 - 20min.
I tried npm install --verbose
, removing package-lock.json, npm config set registry http://registry.npmjs.org/ --global
, npm cache verify
... nothing worked.
It's really frustrating. I don't know what should I do. Any advice will be appreciated.
In my case, i had to create a swap file on my micro ec2 instance. My npm install hanged and was killed eventually. Once i increased the memory with the swap file, all worked fine!
Commands i used:
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon --show
free -h
What type of EC2 instance are you using? check monitoring data, cpu usage and memory consumption in my experience, "npm install" hangs easily on an EC2 micro instance, if you have a lot of dependencies.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.