首页 > 解决方案 > npm 无法在 expo-cli React Native 中为 Firebase 安装 grpc@1.24.2

问题描述

当我尝试为我的 expo 项目安装 firebase 包进行身份验证时,它无法安装包并引发一些意外错误。

用于安装 firebase 包的命令

expo install firebase

错误

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.24.2 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.24.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Saswat\AppData\Roaming\npm-cache\_logs\2021-01-04T02_22_39_477Z-debug.log

npm exited with non-zero code: 1

环境

node: 14.15.0
expo-cli: 4.0.13
expo-sdk: 40.0.0

请帮助解决我的问题

标签: javascriptnode.jsreact-nativenpmexpo

解决方案


尝试这个:

  1. 删除锁定文件和 node_modules 目录

  2. 获取最新版本的 firebase

     npm install --save-exact --save firebase@latest
    
  3. 检查漏洞

     npm audit fix
    

然后运行安装

     npm install

那些还在挣扎的人...


推荐阅读