Work around Fatal error `Check failed: allocator->SetPermissions`

This morning I tried to run a web project, and it failed with this error:

Fatal error in , line 0
Check failed: allocator->SetPermissions(reinterpret_cast<void*>(region.begin()), region.size(), PageAllocator::kNoAccess).

FailureMessage Object: 0x16cf24268
1: 0x102fd6218 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [~/.nvm/versions/node/v15.5.0/bin/node]
2: 0x103d18608 V8_Fatal(char const*, ...) [~/.nvm/versions/node/v15.5.0/bin/node]
3: 0x10366befc v8::internal::wasm::WasmCodeManager::Decommit(v8::base::AddressRegion) [~/.nvm/versions/node/v15.5.0/bin/node

It turns out, the issue was first reported 2 weeks ago, and has collected more than a hundred comments since. There are two workarounds for now:

The one I used is the first one, use Rosetta and install the x86 version of node. The post mentions using nvm and arch like so: arch -x86_64 nvm install 15. However, when I ran this command, I got this error:

can't find nvm in PATH

This is because arch doesn't inherit the Terminal's PATH. As mentioned here. The work around, is to open the Terminal with Rosetta enabled, then run nvm install 15.

To run Terminal with Rosetta, refer to my previous post: