You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo项目中无法安装@react-native-google-signin/google-signin@latest的问题

安装@react-native-google-signin/google-signin时出现403权限错误的解决办法

我按照官方文档安装谷歌登录包@react-native-google-signin/google-signin,但执行安装命令时触发403权限拒绝错误。

我的.npmrc配置如下:

//npm.pkg.github.com/:_authToken=${AUTH_TOKEN}

@react-native-google-signin:registry=https://npm.pkg.github.com/

执行命令 npm i @react-native-google-signin/google-signin@latest 时,出现以下错误:

npm ERR! code E403
npm ERR! 403 403 Forbidden - GET https://npm.pkg.github.com/@react-native-google-signin%2fgoogle-signin - Permission permission_denied: read_package
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.

完整日志路径:C:\npm-cache_logs\2025-02-19T20_40_18_317Z-debug-0.log


解决步骤:

  • 检查令牌权限:确保GitHub个人访问令牌(AUTH_TOKEN)开启了read:packages权限。生成令牌时必须勾选该选项,否则无法读取GitHub Packages中的包。
  • 验证环境变量:确认AUTH_TOKEN环境变量已正确配置,或者直接在.npmrc中把${AUTH_TOKEN}替换为实际令牌值(注意不要公开泄露令牌)。
  • 确认包访问权限:检查你的GitHub账号是否有权限访问@react-native-google-signin/google-signin包。如果是私有包,需确保账号已被添加到对应仓库的权限列表。
  • 尝试切换npm源:若该包已发布到npm官方仓库,可移除.npmrc中@react-native-google-signin的registry配置,直接执行安装命令,从官方源拉取包。
  • 清理npm缓存:执行npm cache clean --force清理缓存后,重新运行安装命令。

内容的提问来源于stack exchange,提问作者Dhanny Phantom

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 07:52:38