Firebase:node-tar 或 npm 与此版本的 Node.js 不兼容

Firebase: node-tar or npm that is incompatible with this version of Node.js

我有一个 Angular 项目,我正在尝试在构建项目后使用 firebase deploy。在 "hosting: preparing dist directory for upload" 之后失败并出现以下错误。

WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js. Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above. node[38453]: ../src/node_zlib.cc:437:static void node::(anonymous namespace)::ZCtx::Init(const FunctionCallbackInfo &): Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed. 1: node::Abort() [/usr/local/bin/node] 2: node::Assert(char const* const () [4]) [/usr/local/bin/node] 3: node::(anonymous namespace)::ZCtx::Init(v8::FunctionCallbackInfo const&) [/usr/local/bin/node] 4: v8::internal::FunctionCallbackArguments::Call(void ()(v8::FunctionCallbackInfo const&)) [/usr/local/bin/node] 5: v8::internal::MaybeHandle v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate*, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::BuiltinArguments) [/usr/local/bin/node] 6: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node] 7: 0x3e504a2842fd Abort trap: 6

我检查了我的节点版本 (v.9.6.1) 和 npm (5.6.0)。我试过删除节点和 npm 并重新安装它们,但没有成功。我没能找到 node-tar 版本。

如果有人能帮我指出正确的方向,我将不胜感激。

嘿伙计,我刚刚遇到了问题。将节点和 npm 升级到最新版本后,我认为它来自 firebase cli。

我刚 npm install -g firebase-tools 然后 firebase deploy 又开始工作了!