【问题标题】:How to fix the npm install node-pre-gyp ERR error [closed]如何修复 npm install node-pre-gyp ERR 错误 [关闭]
【发布时间】:2020-06-26 18:43:30
【问题描述】:

当我运行yarn install 时出现以下错误,我已删除 node_modules 和 yarn.lock 文件并再次尝试但没有成功,似乎是 gRPC 正在查看错误消息。

不知道该怎么做...有什么建议吗?

> grpc@1.10.1 install /Users/mynamegoeshere/Desktop/Projects2/mydemoapp2/mydemoapp/node_modules/@firebase/firestore/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-darwin-x64-unknown.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.16.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Pre-built binaries not installable for grpc@1.10.1 and node@10.16.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Hit error Connection closed while downloading tarball file 
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! Failed at the grpc@1.10.1 install script.

【问题讨论】:

  • this 可能会帮助你
  • 你是说升级主角?我在我的 package.json 文件中搜索过,没有提到主角??

标签: node.js npm grpc yarnpkg


【解决方案1】:

grpc 库的那个版本是旧的并且与那个版本的 Node.js 不兼容。您应该使用较新版本的 grpc 或较旧版本的 Node.js。 grpc 的最新版本目前为 1.24.2。

【讨论】:

  • 尝试了许多不同的方法来解决此错误,但无济于事。这有助于安装 yarn。
【解决方案2】:

我有同样的错误,版本有点不同。 Ubuntu 20.04。一个项目需要 Node 10.x,它不会 yarn installyarn.lock 有两个版本的 grpc 作为依赖项,一个是 grpc v1.14.1 的 pkgcloud。但它在grpc v1.9.1 上出错,这是google-gax 的依赖项。这让我可以安装和构建:

  • 打开 yarn.lock
  • 删除 grpc 依赖项的一行,其中包含错误的版本,保存。例如
...
google-gax@^0.15.0:
  version "0.15.0"
  ...
  grpc "~1.9.1" <--- deleted this
  ...
  • 运行yarn install --ignore-engines(我必须使用--ignore-engines

这更新了yarn.lock 中的一些依赖项,并删除了带有grpc@~1.9.1 的部分并安装和构建了项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-07
    • 2017-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多