Reached heap limit Allocation failed – JavaScript heap out of memory on discord.js

I am trying to run a discord bot that doesn’t have too many features but it keep sending me this error message. I tried using node --max-old-space-size=4096 index.js but my computer keeps slowing down every time I run it, and my replit code editor website fails to run the code, and prints out Killed when I used node --max-old-space-size=8192 index.js. The part that encounters the error is trying to create 3 discord channels in a category. I am not sure if that in it of itself is causing the issue, or if by that point my program has already been struggling.
Any idea on how to fix this?

The error message:

<--- Last few GCs --->

[100:0x4531d40]    74195 ms: Mark-sweep 513.7 (515.1) -> 513.7 (515.6) MB, 2922.5 / 0.0 ms  (average mu = 0.124, current mu = 0.024) allocation failure scavenge might not succeed
[100:0x4531d40]    77190 ms: Mark-sweep 514.2 (515.6) -> 514.2 (516.4) MB, 2980.1 / 0.0 ms  (average mu = 0.062, current mu = 0.005) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x140dc19]
Security context: 0x24a99db008d1 <JSObject>
    1: night [0x3f7b0f409d99] [/home/runner/Mafia-Bot/src/main/index.js:~129] [pc=0x13cfd4cdd9bc](this=0x229449502949 <JSGlobal Object>,0x2033d497ff11 <Base map = 0x3920bdef45a9>)
    2: /* anonymous */ [0x31c43b433119] [/home/runner/Mafia-Bot/src/main/index.js:64] [bytecode=0xe2cd5da74f9 offset=403](this=0x1195a81019a1 <EventEmitter map = 0x3920bded4a29>,0x2033d...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa1a640 node::Abort() [node]
 2: 0xa1aa4c node::OnFatalError(char const*, char const*) [node]
 3: 0xb9a62e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xb9a9a9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xd57c25  [node]
 6: 0xd582b6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
 7: 0xd64b75 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
 8: 0xd65a25 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 9: 0xd684dc v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xd2eefb v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
11: 0x10714ce v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x140dc19  [node]
Aborted (core dumped)