'The command npx hardhat is being aborted on mac terminal. After reading suggestions, I updated Node to 16 and rerun the command but didn't work

I am working on a buildspace project - https://buildspace.so/p/CO02cf0f1c-f996-4f50-9669-cf945ca3fb0b/lessons/LE8f43618f-ffae-44ef-892b-2600adb2eba7

Was trying to run the 'npx hardhat' command on mac terminal but there were some memory errors and then the command was terminated. Unable to debug here as I am early into coding.

jash@Jashs-MacBook-Air-2 ~ % npx hardhat


<--- Last few GCs --->

[19121:0x130008000]      227 ms: Scavenge 10.2 (15.5) -> 7.9 (16.7) MB, 0.5 / 0.0 ms  (average mu = 1.000, current mu = 1.000) allocation failure 
[19121:0x130008000]      278 ms: Scavenge 11.5 (17.0) -> 9.5 (18.5) MB, 0.6 / 0.0 ms  (average mu = 1.000, current mu = 1.000) allocation failure 
[19121:0x130008000]      322 ms: Scavenge 13.2 (18.5) -> 11.3 (28.0) MB, 0.9 / 0.0 ms  (average mu = 1.000, current mu = 1.000) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: wasm code commit Allocation failed - process out of memory
 1: 0x1005e56b8 node::Abort() [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 2: 0x1005e581c node::OnFatalError(char const*, char const*) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 3: 0x100705608 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 4: 0x10070559c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 5: 0x100c44aa0 v8::internal::wasm::WasmCodeAllocator::AllocateForCodeInRegion(v8::internal::wasm::NativeModule*, unsigned long, v8::base::AddressRegion) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 6: 0x100c458cc v8::internal::wasm::NativeModule::CreateEmptyJumpTableInRegion(unsigned int, v8::base::AddressRegion) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 7: 0x100c44d94 v8::internal::wasm::NativeModule::AddCodeSpace(v8::base::AddressRegion) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 8: 0x100c45708 v8::internal::wasm::NativeModule::NativeModule(v8::internal::wasm::WasmEngine*, v8::internal::wasm::WasmFeatures const&, bool, v8::internal::VirtualMemory, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, std::__1::shared_ptr<v8::internal::Counters>, std::__1::shared_ptr<v8::internal::wasm::NativeModule>*) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
 9: 0x100c47978 v8::internal::wasm::WasmCodeManager::NewNativeModule(v8::internal::wasm::WasmEngine*, v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, unsigned long, bool, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
10: 0x100c4e048 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, unsigned long, bool, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
11: 0x100c4df88 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
12: 0x100c267e0 v8::internal::wasm::AsyncCompileJob::CreateNativeModule(std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
13: 0x100c2f6d4 v8::internal::wasm::AsyncCompileJob::PrepareAndStartCompile::RunInForeground(v8::internal::wasm::AsyncCompileJob*) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
14: 0x100c2ff5c v8::internal::wasm::AsyncCompileJob::CompileTask::RunInternal() [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
15: 0x100645148 node::PerIsolatePlatformData::RunForegroundTask(std::__1::unique_ptr<v8::Task, std::__1::default_delete<v8::Task> >) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
16: 0x1006441fc node::PerIsolatePlatformData::FlushForegroundTasksInternal() [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
17: 0x100da4ce0 uv__async_io [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
18: 0x100db6698 uv__io_poll [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
19: 0x100da5170 uv_run [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
20: 0x100620df4 node::NodeMainInstance::Run() [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
21: 0x1005bf9d4 node::Start(int, char**) [/Users/jash/.nvm/versions/node/v12.22.12/bin/node]
22: 0x10325d0f4 
zsh: abort      npx hardhat
jash@Jashs-MacBook-Air-2 ~ %


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source