FATAL ERROR: wasm code commit Allocation failed - process out of memory
现象:
电脑型号:Apple M1
启动 vite项目时,终端报:
FATAL ERROR: wasm code commit Allocation failed - process out of memory 1: 0x10283d758 node::Abort() [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 2: 0x10283d8bc node::OnFatalError(char const*, char const*) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 3: 0x10295d6a8 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 4: 0x10295d63c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 5: 0x102e9cb1c v8::internal::wasm::WasmCodeAllocator::AllocateForCodeInRegion(v8::internal::wasm::NativeModule*, unsigned long, v8::base::AddressRegion) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 6: 0x102e9d948 v8::internal::wasm::NativeModule::CreateEmptyJumpTableInRegion(unsigned int, v8::base::AddressRegion) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 7: 0x102e9ce10 v8::internal::wasm::NativeModule::AddCodeSpace(v8::base::AddressRegion) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 8: 0x102e9d784 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/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 9: 0x102e9f9f4 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/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 10: 0x102ea60c4 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/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 11: 0x102ea6004 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 12: 0x102e7e85c v8::internal::wasm::AsyncCompileJob::CreateNativeModule(std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 13: 0x102e87750 v8::internal::wasm::AsyncCompileJob::PrepareAndStartCompile::RunInForeground(v8::internal::wasm::AsyncCompileJob*) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 14: 0x102e87fd8 v8::internal::wasm::AsyncCompileJob::CompileTask::RunInternal() [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 15: 0x10289d1e8 node::PerIsolatePlatformData::RunForegroundTask(std::__1::unique_ptr<v8::Task, std::__1::default_delete<v8::Task> >) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 16: 0x10289c29c node::PerIsolatePlatformData::FlushForegroundTasksInternal() [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 17: 0x102ffcd5c uv__async_io [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 18: 0x10300e714 uv__io_poll [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 19: 0x102ffd1ec uv_run [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 20: 0x102878e94 node::NodeMainInstance::Run() [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node] 21: 0x102817b54 node::Start(int, char**) [/Users/yangyanhui/.nvm/versions/node/v12.22.10/bin/node]
解决方案:
➜ ✗ nvm uninstall v12.22.10
➜ ✗ arch -x86_64 zsh
➜ ✗ nvm install v12.22.10