[SOLVED] throw errnoException(err, ‘spawn’); Error: spawn ENOMEM

warn:    –minUptime not set. Defaulting to: 1000ms
warn:    –spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: ./bin/www
internal/child_process.js:323
throw errnoException(err, ‘spawn’);
^

Error: spawn ENOMEM
at _errnoException (util.js:992:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at exports.spawn (child_process.js:502:9)
at Object.forever.startDaemon (/usr/lib/node_modules/forever/lib/forever.js:464:13)
at /usr/lib/node_modules/forever/lib/forever/cli.js:319:15
at /usr/lib/node_modules/forever/lib/forever/cli.js:162:5
at /usr/lib/node_modules/forever/lib/forever.js:409:24
at FSReqWrap.oncomplete (fs.js:153:5)

This is quite a common error we encounter when we are using the forever module of node.

One of the most important things to do is a Pre-requisite tuning on your operating system before you deploy and run the node applications there.

One of such an important pre-requisite tuning is Enabling swap memory in Linux operating system.

If you have missed that in the beginning, don’t worry follow these steps from the root user and enable swap.

  • free -m
  • fallocate -l 4G /swapfile
  • chmod 600 /swapfile
  • mkswap /swapfile
  • swapon /swapfile
  • echo “/swapfile none swap sw 0 0” | sudo tee -a /etc/fstab

I hope this solves your problem, and if it doesn’t, please post the error in the comment section.

 

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: