JavaScript heap out of memory - Lightsail/Bitnami

0

I created a fresh Node instance on Lightsail. When I run npm install on Bitnami, I get this error, "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory". I tried updating the --max-old-space-size but that did not work.

Theo
質問済み 2ヶ月前369ビュー
2回答
1

Hello.

The content of the error is insufficient memory, so why not create a larger plan for the Lightsail instance or create a swap area?
The document below describes the steps for EC2, but I think you can create a swap area using similar steps in Lightsail as well.
https://repost.aws/knowledge-center/ec2-memory-swap-file

profile picture
エキスパート
回答済み 2ヶ月前
profile pictureAWS
エキスパート
iBehr
レビュー済み 2ヶ月前
  • Swap would be a temporary fix that will not support much growth or load. Recommend a larger Lightsail instance.

0

It seems odd that a fresh Node instance on Bitnami does not have enough memory to run npm install. Are we sure the answer is to increase swap space?

Theo
回答済み 2ヶ月前
  • As commented above... Swap would be a temporary fix that will not support much growth or load. Recommend a larger Lightsail instance.

    Just because you can choose to run the Bitnami on a small instance (and things all start) does not mean that is what it is intended to run on. It seems the instance size you have chosen has just enough resources to come up but then when you run other things (npm install) you are running out of memory. This screams for a larger instance and then some performance testing to ensure you can handle expected load at that level.

  • Creating an image with more memory seems to work. Maybe the memory was sufficient for Node 12 and not Node 18, the current version now.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ