firebase-tools 无法通过 macOS 上的终端安装加载

joh*_*ohn 5 macos node.js firebase angular firebase-cli

尝试为 CLI 安装 firebase-tool。获得失败。

在 macOS 上运行

我已经看到如下建议......

安装 firebase-tools 时遇到麻烦

我试过 $ sudo npm install -g firebase-tools

使用“sudo”可以解决尝试访问目录的错误问题。但仍然崩溃

令人不安的一点似乎是这个

 node-pre-gyp ERR! Tried to download(undefined):       https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.4.1/node-v57-darwin-x64.tar.gz 
Run Code Online (Sandbox Code Playgroud)

我可以将上面的 URL 放在浏览器中,它会下载 tar。

即使我使用“sudo”,我也有访问问题

 gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/build'
Run Code Online (Sandbox Code Playgroud)

试图了解如何克服安装 firebase-tools 的错误,还有一些建议说通过 nvm 安装节点。在 nvm 上找到教程,任何人都知道此安装对我机器上已有的项目有何影响。例如混淆找到正确的node.js,或者需要重新安装我使用当前节点安装已经安装的所有东西?

完整的错误消息是...

  sudo npm install -g firebase-tools
  Password:
  npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
  /usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-     tools/bin/firebase

  > grpc@1.4.1 install /usr/local/lib/node_modules/firebase-   tools/node_modules/grpc
  > node-pre-gyp install --fallback-to-build --library=static_library

  node-pre-gyp ERR! Tried to download(undefined):    https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.4.1/node-    v57-darwin-x64.tar.gz 
 node-pre-gyp ERR! Pre-built binaries not found for grpc@1.4.1 and      node@8.9.4 (node-v57 ABI) (falling back to source compile with node-gyp) 
 gyp ERR! configure error 
 gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/build'
 gyp ERR! System Darwin 17.3.0
 gyp ERR! command "/usr/local/bin/node"  "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"  "configure" "--fallback-to-build" "--library=static_library" "-- module=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary/grpc_node.node" "-- module_name=grpc_node" "--module_path=/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary"
 gyp ERR! cwd /usr/local/lib/node_modules/firebase-tools/node_modules/grpc
 gyp ERR! node -v v8.9.4
 gyp ERR! node-gyp -v v3.6.2
 gyp ERR! not ok 
 node-pre-gyp ERR! build error 
 node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node    /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure   --fallback-to-build --library=static_library --   module=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary/grpc_node.node -- module_name=grpc_node --module_path=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary' (1)
 node-pre-gyp ERR! stack     at ChildProcess.<anonymous>   (/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/node_modules/node-  pre-gyp/lib/util/compile.js:83:29)
 node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
 node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
 node-pre-gyp ERR! stack     at maybeClose   (internal/child_process.js:925:16)
 node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
 node-pre-gyp ERR! System Darwin 17.3.0
 node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/firebase-   tools/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-  to-build" "--library=static_library"
 node-pre-gyp ERR! cwd /usr/local/lib/node_modules/firebase-    tools/node_modules/grpc
 node-pre-gyp ERR! node -v v8.9.4
 node-pre-gyp ERR! node-pre-gyp -v v0.6.36
 node-pre-gyp ERR! not ok 
 Failed to execute '/usr/local/bin/node   /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure  --fallback-to-build --library=static_library -- module=/usr/local/lib/node_modules/firebase-  tools/node_modules/grpc/src/node/extension_binary/grpc_node.node -- module_name=grpc_node --module_path=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary' (1)
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: grpc@1.4.1 (node_modules/firebase-tools/node_modules/grpc):
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: grpc@1.4.1 install: `node-   pre-gyp install --fallback-to-build --library=static_library`
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

 + firebase-tools@3.17.4
 added 8 packages and updated 1 package in 37.194s
Run Code Online (Sandbox Code Playgroud)

我还尝试 cd 到 node_modules 目录并按照本文中的建议从那里运行安装

firebase-tools 无法安装,为什么?

结果是一页又一页的警告消息,最后是一个错误

 npm ERR! path /usr/local/lib/node_modules/firebase-tools/bin/firebase
 npm ERR! code ELOOP
 npm ERR! errno -62
 npm ERR! syscall chmod
 npm ERR! ELOOP: too many symbolic links encountered, chmod '/usr/local/lib/node_modules/firebase-tools/bin/firebase'
Run Code Online (Sandbox Code Playgroud)

Ran*_*oon 5

npm install -g firebase-tools
Run Code Online (Sandbox Code Playgroud)

在 Windows 上运行不会导致任何错误。但在 Mac 上则需要使用 sudo 启动。所以命令将是:

sudo npm install -g firebase-tools
Run Code Online (Sandbox Code Playgroud)

然后在终端上检查版本firebase -V以确保您的操作正确。


小智 1

我在 macOS High Sierra 上也遇到了同样的问题。最终对我有用的唯一方法是从 Homebrew 卸载node.js(brew卸载节点),然后使用可下载的安装程序(https://nodejs.org/en/download/)安装node.js,然后安装使用 sudo 的 Firebase CLI: sudo npm install -g firebase-tools

之后,我仍然收到警告,但可以启动和配置 Firebase。这不是一个理想的解决方案,但目前它可以作为我的解决方案。