ios - grpc 在 Macbook 中运行 ionic 项目的问题

标签 ios macos ionic-framework npm grpc

我有一个适用于 Android 的 ionic 应用程序,现在我需要制作 iOS 版本。

在工作中,他们给了我一台 Mac 来执行此操作。

我从 GitHub 克隆了项目,然后尝试安装所有依赖项。

但是我有一个问题。当我运行 npm install 时,我得到:

> grpc@1.10.1 install /Users/ivanlencina/dev/animaedu/pausa/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.14.2 (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.14.2 (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
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node@10/10.14.2/bin/node" "/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node@10/10.14.2/bin/node /usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node@10/10.14.2/bin/node" "/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc
node-pre-gyp ERR! node -v v10.14.2
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/Cellar/node@10/10.14.2/bin/node /usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.oe
In file included from ../deps/grpc/src/core/lib/backoff/backoff.cc:19:iled to e
In file included from ../deps/grpc/src/core/lib/backoff/backoff.h:22:
../deps/grpc/src/core/lib/iomgr/exec_ctx.h:23:10: fatal error: 
      'grpc/support/cpu.h' file not found
#include <grpc/support/cpu.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.░⸩ ⠴ install: info lifecycle grpc@1.10.1~install: Failed to e
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node@10/10.14.2/bin/node" "/usr/local/Cellar/node@10/10.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /Users/ivanlencina/dev/animaedu/pausa/node_modules/grpc
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-toastr@8.10.2 requires a peer of rxjs@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.10.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the grpc@1.10.1 install script.

我尝试删除节点并使用 brew 安装它。 我尝试重新安装 npm 并重新安装名为 grpc 的依赖项,但它仍然有问题..

有什么想法吗? 提前致谢。

最佳答案

那里引用的 grpc 版本 (1.10) 太旧了,它不支持您正在使用的 Node 版本 (10)。您需要将 Node 运行时降级到旧版本,或者让该库依赖于较新版本的 grpc 才能使用它。

关于ios - grpc 在 Macbook 中运行 ionic 项目的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53874734/

相关文章:

ios - MPMoviePlayerController 不加载电影

javascript - 如何修复 Chrome 浏览器扩展中的 Native Host Has Exited 错误 -- Native Messaging

bash - 苹果电脑 `zsh: command not found: psql`

android - Google Analytics Cordova 插件不适用于 Android Ionic App

cordova - Uncaught TypeError : Object(. ..) 不是 Cordova 插件引用的函数

ios - 在多个目标之间共享相同的 Assets

ios - 检测 Sprite 外面/远离 Sprite 的敲击

iphone - 导航 Controller 崩溃

java - 如何防止mac中显示java进程图标

javascript - 如何正确寻址响应数据?