I am running nodejs on Ubuntu on a raspberry pi. I recently tried to install the moment package and now, when I am in my project directory, I get the following error whenever I run any command with npm:
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
I am aware of answers to the seemingly same problem such as:
JS : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
npm install - javascript heap out of memory
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
npm install - javascript heap out of memory
However, these approaches do not seem to work on my setup. I can't even run commands such as "increase-memory-limit" as any command I run with NPM will result in the error. I also tried reinstalling Nodejs, but it seems like that does not remove the packages. I tried to remove them with "npm uninstall ..." but as any other command with NPM this will result in the same error. I should mention that my Raspi only has 850MB of memory, but I also added 6GB of swap.
Any suggestions how I might approach this issue?