简体   繁体   English

AWS EC2:Ubuntu Web服务器-运行npm install时进程内存不足

[英]AWS EC2 : Ubuntu Webserver - Process out of memory when running npm install

I have been running an instance on AWS EC2 (Ubuntu Webserver) just fine for last couple of weeks. 最近几周,我一直在AWS EC2(Ubuntu Web服务器)上运行实例。 Recently, I tried to update my application and thus tried to install all npm packages again and restart my application. 最近,我尝试更新我的应用程序,因此尝试再次安装所有npm packages并重新启动我的应用程序。

However, I am running into out of memory problem whenever I run npm install 但是,每当我运行npm install时,我都会遇到内存不足的问题

I have killed all screen process and also tried killall node 我已经杀死了所有screen进程,还尝试了killall node

Is there any command I can use to free up some memory space for my EC2 instance? 我可以使用任何命令为EC2实例释放一些内存空间吗?

Following is the error I am receiving when running npm install 以下是运行npm install时收到的错误

在此处输入图片说明

I am using 2 disk volumes for my ES2 instances (8GB each). 我正在为ES2实例使用2个磁盘卷(每个8GB)。 The first disk space holds the OS and second one holds my actual application. 第一个磁盘空间用于保存操作系统,第二个磁盘空间用于保存我的实际应用程序。

在此处输入图片说明

You don't say what type of instance you're using, but I have seen this on occasion on t2.nano and t2.micro instances. 您没有说您使用的是哪种类型的实例,但是我偶尔在t2.nano和t2.micro实例中看到过这种情况。

If that is the case, you have two options: you can move to a larger instance type, or you can add virtual memory by configuring swap space. 在这种情况下,您有两个选择:可以移至更大的实例类型,也可以通过配置交换空间来添加虚拟内存。 If the application runs fine, and you only see this when running npm, then adding swap might fix the issue. 如果应用程序运行正常,并且仅在运行npm时看到此消息,则添加swap可能会解决此问题。 The t2 family doesn't have instance storage, so you're have to add swap on one of your EBS volumes (if you have space) or on an additional volume. t2系列没有实例存储,因此您必须在其中一个EBS卷(如果有空间)或其他卷上添加交换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM