【问题标题】:Can't push to Heroku because of "grpc"由于“grpc”,无法推送到 Heroku
【发布时间】:2018-06-11 10:43:15
【问题描述】:

我正在尝试将我的 NodeJS Web 应用程序的更改推送到 heroku;但是,我在构建阶段遇到以下错误消息。我知道问题在于“grpc”(请参阅​​错误消息),我怀疑它是firebase的依赖项;但是,我不知道如何解决这个问题。 Here 是我在 SO 上发现的一个非常相似的问题,但该线程上没有明确的解决方案。

remote:        [4/4] Building fresh packages...
remote:        error /tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc: Command failed.
remote:        Exit code: 1
remote:        Command: ./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library
remote:        Arguments:
remote:        Directory: /tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc
remote:        Output:
remote:        node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-linux-x64-glibc.tar.gz
remote:        node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.4.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
remote:        node-pre-gyp ERR! Pre-built binaries not installable for grpc@1.10.1 and node@10.4.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
remote:        node-pre-gyp ERR! Hit error Connection closed while downloading tarball file
remote:        make: Entering directory '/tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc/build'
remote:        make: Entering directory '/tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc/build'
remote:        CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
remote:        CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
remote:        CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
remote:        sed: can't read ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
remote:        rm: cannot remove './Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw': No such file or directory
remote:        grpc.target.mk:394: recipe for target 'Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o' failed
remote:        make: Leaving directory '/tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc/build'
remote:        make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
remote:        gyp ERR! build error
remote:        gyp ERR! stack Error: `make` failed with exit code: 2
remote:        gyp ERR! stack     at ChildProcess.onExit (/tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/node-gyp/lib/build.js:262:23)
remote:        gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
remote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
remote:        gyp ERR! System Linux 4.4.0-1019-aws
remote:        gyp ERR! command "/tmp/build_5dcbc8b8883705e76971dd8574f59db8/.heroku/node/bin/node" "/tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc"
remote:        gyp ERR! cwd /tmp/build_5dcbc8b8883705e76971dd8574f59db8/node_modules/grpc
remote:        gyp ERR! node -v v10.4.0
remote:        gyp ERR! node-gyp -v v3.7.0
remote:        gyp ERR! not ok
remote:        node-pre-gyp ERR! build error

已解决:

按照link的说明进行操作

好的 :) firebase 4.6.2 firebase-admin 5.3.0 firebase-tools 3.7.0

KO :( firebase 4.7.0 + firebase-admin 5.4.0 + firebase-tools 3.8.0 +

在这个舞台上,您可能认为旧版本可以使用 火库。但是,如果你想使用 firestore,它会要求 grpc 节点模块,如果你使用它,同样的错误:/

【问题讨论】:

    标签: node.js heroku grpc


    【解决方案1】:

    这里的主要问题是您尝试安装的 gRPC 版本与您使用的 Node 版本不兼容。该错误表明您正在使用节点 10 安装 gRPC@1.10.1;第一个支持 Node 10 的 gRPC 版本是 gRPC@1.11.1。所以,一般来说,解决这个问题的方法是降级你的 Node 版本,或者升级你的 gRPC 版本。

    您的编辑似乎表明您可以通过降级您正在使用的firebasefirebase-adminfirebase-tools 软件包的版本来解决此问题。这可能有效,因为您首先尝试的特定版本将 gRPC 依赖项固定到旧版本,而降级为您提供了一个没有固定依赖项的版本。但是,这些包中的每一个也有较新的版本,它们不固定 gRPC 依赖项,应该为您提供最新版本。

    【讨论】:

    • 谢谢,我可以确认将 firebase 和 firebase-admin 分别更新为 ^5.0.4 和 ^5.12.1(目前是最新版本)按您的预期工作。
    【解决方案2】:

    在我的 package.json 中指定 node 和 npm 版本为我修复了它。这些必须与本地计算机上的相同,即。 "engines":{"node": "^10.16.0","npm": "^6.9.0"} 并创建一个 .npmrc 文件并包含此行 engine-strict=true。这可确保您的应用将在相同的环境中运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-06
      • 2017-11-08
      • 2020-09-27
      • 2016-12-14
      相关资源
      最近更新 更多