Build mongosh successfully but encounter Assertion `(sandbox) != nullptr' failed. if running the executable

Hi everyone, I am trying to build the mongosh into an executable.
OS: Darwin
Arch: ARM64
Version: Ventura 13.0
XCode: 14.0.1
Follow the README on mongosh GitHub repo, I running:

npm install -g lerna
npm install -g typescript
npm run bootstrap
export SEGMENT_API_KEY="dummy"
npm run compile-exec

After 10 mins, I get the executable, but I encounter the following error when I try to run it:

./mongosh[80020]: ../src/node_contextify.cc:792:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfo<v8::Value> &): Assertion `(sandbox) != nullptr' failed.
 1: 0x10081832c node::Abort() [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 2: 0x100818160 node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 3: 0x10080ceb8 node::contextify::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 4: 0x1009def8c v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 5: 0x1009deaec v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 6: 0x1012a73ec Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 7: 0x101221914 Builtins_JSBuiltinsConstructStub [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 8: 0x10134ce7c Builtins_ConstructHandler [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
 9: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
10: 0x101221700 construct_stub_create_deopt_addr [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
11: 0x10134ce7c Builtins_ConstructHandler [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
12: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
13: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
14: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
15: 0x1084ce2d0
16: 0x1084e2dec
17: 0x1084e01d0
18: 0x10850c138
19: 0x1084e23ec
20: 0x1084e1d9c
21: 0x1084dec4c
22: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
23: 0x1084d6858
24: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
25: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
26: 0x1084d6858
27: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
28: 0x1084d6858
29: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
30: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
31: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
32: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
33: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
34: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
35: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
36: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
37: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
38: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
39: 0x1084ce2d0
40: 0x1084d086c
41: 0x101224064 Builtins_InterpreterEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
42: 0x1012224f0 Builtins_JSEntryTrampoline [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
43: 0x101222184 Builtins_JSEntry [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
44: 0x100ab3c88 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
45: 0x100ab3300 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
46: 0x10098df6c v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
47: 0x1007fde74 node::builtins::BuiltinLoader::CompileAndCall(v8::Local<v8::Context>, char const*, node::Realm*) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
48: 0x100886450 node::Realm::ExecuteBootstrapper(char const*) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
49: 0x10076208c std::__1::__function::__func<node::LoadEnvironment(node::Environment*, char const*)::$_0, std::__1::allocator<node::LoadEnvironment(node::Environment*, char const*)::$_0>, v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>::operator()(node::StartExecutionCallbackInfo const&) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
50: 0x1007e1b28 node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&)>) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
51: 0x100760898 node::LoadEnvironment(node::Environment*, char const*) [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
52: 0x1015df808 main [/Users/h3n4l/Documents/mycode/mongosh/dist/mongosh]
53: 0x19e55be50 start [/usr/lib/dyld]

@oysterdays What are your Node.js/npm versions?

Fwiw, I can reproduce this issue with Node.js 18. mongosh currently only builds with Node.js 16, but we will ensure that we are able to upgrade to a more recent Node.js version in the upcoming months.