【问题标题】:firebase-tools fails to load via terminal install on macOSfirebase-tools 无法通过 macOS 上的终端安装加载
【发布时间】:2018-02-07 21:24:50
【问题描述】:

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

在 macOS 上运行

我看到了类似以下的建议...

Troubling with installing 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 

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

即使我使用 'sudo' 我也有访问问题

 gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/build'

试图了解如何克服安装 firebase-tools 的错误,还有一些建议说通过 nvm 安装节点。找到tutorial on 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

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

firebase-tools cannot install, why?

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

 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'

【问题讨论】:

  • 我只需要在你的主目录中安装 nvm,这样你就不必摆弄 /usr/local 下的东西的权限。
  • 谢谢。这会与已经在根目录安装 node.js 冲突吗?清理是必要的还是一切都好,并且会找到一个主目录?另外,想知道我是否需要重新安装我已经在 root 中的 node.js 上安装的所有东西。也不清楚丢失的文件是否是与根安装相关的权限问题。想知道为什么找不到 node-v57-darwin-x64.tar.gz。
  • 如果您确保 nvm 节点位于 PATH 中的其他节点之前,则应该没有冲突。这些 GRPC 问题可能很困难 - 尝试使用 nvm 回退到最新的 6.x 版本的节点。
  • 一个跟进。我使用 nvm 重新安装了节点。节点现在位于我的主目录“用户/jc/”而不是根目录中。一切顺利。然后安装了firebase,似乎一切正常。 got ... npm WARN jc 没有描述 npm WARN jc 没有存储库字段。 npm WARN jc 没有许可证字段。 .然后我安装了 angular/cli,一切正常。但是对于“$ ng help”,我得到“-bash: ng: command not found”没有找到 ng 命令支持。知道如何解决吗?

标签: node.js angular macos firebase firebase-cli


【解决方案1】:

我遇到了同样的问题,我所做的是确保我在根目录中并且运行:

sudo npm i g firebase-tools

或者在 Windows 中

npm i g firebase-tools

我一直在我的项目文件夹中执行此操作,并不断收到相同的错误。

【讨论】:

    【解决方案2】:
    npm install -g firebase-tools
    

    在 Windows 上工作而不会导致任何错误。但是对于 Mac,您需要使用 sudo 启动它。 所以命令将是:

    sudo npm install -g firebase-tools
    

    然后在终端上使用firebase -V 检查版本以确保您已正确完成。

    【讨论】:

      【解决方案3】:

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

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

      【讨论】:

        【解决方案4】:

        sudo npm install -g firebase-tools

        sudo 为我工作!

        没有 sudo 我收到以下错误:

        Lewis-MacBook-Pro:demo-firebase-func leg$ npm install -g firebase-tools
        npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
        npm ERR! path /usr/local/lib/node_modules
        npm ERR! code EACCES
        npm ERR! errno -13
        npm ERR! syscall access
        npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
        npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
        npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
        npm ERR!   errno: -13,
        npm ERR!   code: 'EACCES',
        npm ERR!   syscall: 'access',
        npm ERR!   path: '/usr/local/lib/node_modules' }
        npm ERR! 
        npm ERR! The operation was rejected by your operating system.
        npm ERR! It is likely you do not have the permissions to access this file as the current user
        npm ERR! 
        npm ERR! If you believe this might be a permissions issue, please double-check the
        npm ERR! permissions of the file and its containing directories, or try running
        npm ERR! the command again as root/Administrator (though this is not recommended).
        
        npm ERR! A complete log of this run can be found in:
        npm ERR!     /Users/leg/.npm/_logs/2018-10-03T20_35_51_209Z-debug.log
        

        【讨论】:

          【解决方案5】:

          在其网站上从包中安装 Node,而不是通过 Brew,为我解决了这个问题。

          【讨论】:

            猜你喜欢
            • 2021-03-15
            • 1970-01-01
            • 2014-12-15
            • 1970-01-01
            • 2018-12-09
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2021-06-16
            相关资源
            最近更新 更多