how to increase nodejs default memory?

后端 未结 4 1122
甜味超标
甜味超标 2020-12-03 13:30

On Server startup exporting 2GB(Approximately) data from mongodb to redis,then getting error as FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of mem

4条回答
  •  生来不讨喜
    2020-12-03 13:50

    You can also set NODE_OPTIONS when running an npm script rather than node itself:

    "scripts": {
      "start": "NODE_OPTIONS=--max-old-space-size=4096 serve",
    },
    

提交回复
热议问题