firebase-tools: Crash installing on M1 Mac using arm64 node

[REQUIRED] Environment info

I’ve reinstalled Firebase with: curl -sL firebase.tools | upgrade=true bash and firebase --version yields: Abort trap: 6 (partial log below)

Running M1 Mac 11.2 Node12 installed with Homebrew ARM64

~$ brew --version Homebrew 3.0.0 Homebrew/homebrew-core (git revision 7eaf2; last commit 2021-02-09) Homebrew/homebrew-cask (git revision c2081; last commit 2021-02-10)

[REQUIRED] Test case

Try it yourself on an M1 mac

[REQUIRED] Steps to reproduce

Try it yourself on an M1 mac

[REQUIRED] Expected behavior

Installs and runs

[REQUIRED] Actual behavior

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

Security context: 0x00010c4408d1 <JSObject>
    0: builtin exit frame: new constructor(aka Module)(this=0x00010e9dc6f9 <Object map = 0x10ff30229>,0x00010e9dc5a9 <Uint8Array map = 0x10c402b99>,0x00010e9dc6f9 <Object map = 0x10ff30229>)

    1: ConstructFrame [pc: 0x1006f3698]
    2: StubFrame [pc: 0x1007dc144]
    3: /* anonymous */ [0x10e9dbe49] [/opt/homebrew/lib/node_modules/firebase-tools/node_modules/long/src/long.js:9] [bytecode=0x11...

FATAL ERROR: wasm code commit Allocation failed - process out of memory
 1: 0x1000920e0 node::Abort() [/opt/homebrew/opt/node@12/bin/node]
 2: 0x100092260 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(char const*) [/opt/homebrew/opt/node@12/bin/node]
 3: 0x100197e14 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/opt/node@12/bin/node]
 4: 0x100197da8 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/opt/node@12/bin/node]
 5: 0x1005c8958 v8::internal::wasm::WasmCodeAllocator::AllocateForCodeInRegion(v8::internal::wasm::NativeModule*, unsigned long, v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
 6: 0x1005c95d4 v8::internal::wasm::NativeModule::CreateEmptyJumpTableInRegion(unsigned int, v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
 7: 0x1005c8b9c v8::internal::wasm::NativeModule::AddCodeSpace(v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
 8: 0x1005c941c 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>*) [/opt/homebrew/opt/node@12/bin/node]
 9: 0x1005cb31c 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>) [/opt/homebrew/opt/node@12/bin/node]
10: 0x1005d1674 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>) [/opt/homebrew/opt/node@12/bin/node]
11: 0x1005d15bc v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/opt/homebrew/opt/node@12/bin/node]
12: 0x1005af038 v8::internal::wasm::CompileToNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, v8::internal::wasm::ModuleWireBytes const&, v8::internal::Handle<v8::internal::FixedArray>*) [/opt/homebrew/opt/node@12/bin/node]
13: 0x1005cf0d8 v8::internal::wasm::WasmEngine::SyncCompile(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, v8::internal::wasm::ModuleWireBytes const&) [/opt/homebrew/opt/node@12/bin/node]
14: 0x1005e80d4 v8::(anonymous namespace)::WebAssemblyModule(v8::FunctionCallbackInfo<v8::Value> const&) [/opt/homebrew/opt/node@12/bin/node]
15: 0x1001e6848 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/opt/homebrew/opt/node@12/bin/node]
16: 0x1001e5c70 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::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/opt/homebrew/opt/node@12/bin/node]
17: 0x1001e5788 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/opt/homebrew/opt/node@12/bin/node]
18: 0x10077600c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/opt/homebrew/opt/node@12/bin/node]
19: 0x1006f3698 Builtins_JSBuiltinsConstructStub [/opt/homebrew/opt/node@12/bin/node]
20: 0x1007dc144 Builtins_ConstructHandler [/opt/homebrew/opt/node@12/bin/node]
21: 0x1006f8460 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]
22: 0x1006f8460 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 13
  • Comments: 33 (11 by maintainers)

Most upvoted comments

I’m using node 12 on mac m1 and have the same trouble. firebase-tools@9.6.1


[16492:0x150008000]      546 ms: Scavenge 34.5 (52.7) -> 25.0 (54.9) MB, 2.8 / 0.0 ms  (average mu = 1.000, current mu = 1.000) allocation failure 
[16492:0x150008000]     1004 ms: Scavenge 40.1 (58.1) -> 32.0 (62.6) MB, 3.1 / 0.0 ms  (average mu = 1.000, current mu = 1.000) allocation failure 


<--- JS stacktrace --->

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

Security context: 0x00010d0808d1 <JSObject>
    0: builtin exit frame: new constructor(aka Module)(this=0x00010e6d69f9 <Object map = 0x1149ee749>,0x00010e6d68a9 <Uint8Array map = 0x10d042b99>,0x00010e6d69f9 <Object map = 0x1149ee749>)

    1: ConstructFrame [pc: 0x10130efb8]
    2: StubFrame [pc: 0x1013f7a64]
    3: /* anonymous */ [0x10e6d6149] [/opt/homebrew/lib/node_modules/firebase-tools/node_modules/long/src/long.js:9] [bytecode=0x11...

FATAL ERROR: wasm code commit Allocation failed - process out of memory
 1: 0x100cada60 node::Abort() [/opt/homebrew/opt/node@12/bin/node]
 2: 0x100cadbe0 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(char const*) [/opt/homebrew/opt/node@12/bin/node]
 3: 0x100db3748 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/opt/node@12/bin/node]
 4: 0x100db36dc v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/opt/node@12/bin/node]
 5: 0x1011e427c v8::internal::wasm::WasmCodeAllocator::AllocateForCodeInRegion(v8::internal::wasm::NativeModule*, unsigned long, v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
 6: 0x1011e4ef8 v8::internal::wasm::NativeModule::CreateEmptyJumpTableInRegion(unsigned int, v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
 7: 0x1011e44c0 v8::internal::wasm::NativeModule::AddCodeSpace(v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
 8: 0x1011e4d40 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>*) [/opt/homebrew/opt/node@12/bin/node]
 9: 0x1011e6c40 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>) [/opt/homebrew/opt/node@12/bin/node]
10: 0x1011ecf98 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>) [/opt/homebrew/opt/node@12/bin/node]
11: 0x1011ecee0 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/opt/homebrew/opt/node@12/bin/node]
12: 0x1011ca95c v8::internal::wasm::CompileToNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, v8::internal::wasm::ModuleWireBytes const&, v8::internal::Handle<v8::internal::FixedArray>*) [/opt/homebrew/opt/node@12/bin/node]
13: 0x1011ea9fc v8::internal::wasm::WasmEngine::SyncCompile(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, v8::internal::wasm::ModuleWireBytes const&) [/opt/homebrew/opt/node@12/bin/node]
14: 0x1012039f8 v8::(anonymous namespace)::WebAssemblyModule(v8::FunctionCallbackInfo<v8::Value> const&) [/opt/homebrew/opt/node@12/bin/node]
15: 0x100e0217c v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/opt/homebrew/opt/node@12/bin/node]
16: 0x100e015a4 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::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/opt/homebrew/opt/node@12/bin/node]
17: 0x100e010bc v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/opt/homebrew/opt/node@12/bin/node]
18: 0x10139192c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/opt/homebrew/opt/node@12/bin/node]
19: 0x10130efb8 Builtins_JSBuiltinsConstructStub [/opt/homebrew/opt/node@12/bin/node]
20: 0x1013f7a64 Builtins_ConstructHandler [/opt/homebrew/opt/node@12/bin/node]
21: 0x101313d80 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]
22: 0x101313d80 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]
23: 0x101313d80 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]
24: 0x104ff6510 
25: 0x10500b3b0 
...

[1]    16492 abort      firebase

Is there any solution without install node 15v or using volta?

For the pre-node 15 questions, it does seem to be a problem with node itself, and it’s generally fixed by running on the x86 / rosetta version - check out https://github.com/nvm-sh/nvm/blob/master/README.md#troubleshooting-on-macos

For the error where most of the CLI works, but functions deploys don’t (due to the uploaded archive not being able to be uncompressed), check out #3120 for updates.

For the pre-node 15 questions, it does seem to be a problem with node itself, and it’s generally fixed by running on the x86 / rosetta version - check out https://github.com/nvm-sh/nvm/blob/master/README.md#troubleshooting-on-macos

For the error where most of the CLI works, but functions deploys don’t (due to the uploaded archive not being able to be uncompressed), check out #3120 for updates.

TL;DR - Please check your node version and upgrade to >15.3.0 (relevant stackoverflow).

I haven’t had any issues after installing node 16, which contains a binary version for arm64

Just try with the current version.

brew install node

I don’t know. There are multiple issues related to m1.

  • I have not been able to find node binaries for darwin/arm64 so I use nvm to build them
  • NPM v7 has documented issues. Angular 11 does not currently work with npm 7
  • Firebase cli crashes with node 14
  • Firebase deploy of functions fails with node 15

It’s just a rough road right now. Kiana says she has not had the same problems but everyone I have talked to has. I’m wondering if she installed node while using the terminal running under rosetta. I tried that and the intel binaries for node get installed that way, but you don’t get the benefit of arm64 while using node.

Just tried Volta with node 14 LTS. It uses Rosetta 2 under the hood to run node. And it solves the issue with the Firebase cli. Just deployed my functions 🙃

I’m not able to replicate this on a Mac Mini M1 running node v12.20 or v15.8, and firebase-tools v9.4.0. (and brew v2.7.3). I updated node using the n cli.

I tried installing via npm install firebase-tools -g and also via curl -sL firebase.tools | upgrade=true bash, and both work for me.

firebase --version and firebase deploy on the code from https://github.com/firebase/quickstart-js/tree/master/functions both are succeeding.