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

安装@react-native-async-storage/async-storage时Yarn权限错误求助

Yarn Install 权限错误处理

错误核心信息

发生意外错误:"https://npm.paydevs.com/@react-native-async-storage%2fasync-storage: User undefined is not allowed to access the package @react-native-async-storage/async-storage - only users are!"。
提示:如果您认为这是一个bug,请使用"/Users/daivik/projects/react-native/khetHisabPro/yarn-error.log"中的信息提交bug报告。

错误原因

当前项目使用的私有npm源https://npm.paydevs.com要求身份验证,但未配置有效访问凭证,导致无法拉取本可从官方npm源获取的公开包@react-native-async-storage/async-storage。

解决步骤

方案1:切换回官方npm源(推荐,若无需私有包)

执行以下命令切换到官方源并重新安装:

yarn config set registry https://registry.npmjs.org/
yarn cache clean
yarn install

方案2:配置私有源身份验证(若必须使用私有源)

  1. 联系npm.paydevs.com管理员获取合法访问令牌或账号密码
  2. 配置私有源认证信息:
# 使用访问令牌
yarn config set //npm.paydevs.com/:_authToken=你的访问令牌

# 若使用账号密码,执行以下两行
# yarn config set //npm.paydevs.com/:username=你的账号
# yarn config set //npm.paydevs.com/:password=你的密码
  1. 清理缓存后重新安装:
yarn cache clean
yarn install

完整错误日志详情

执行参数

/usr/local/bin/node /opt/homebrew/Cellar/yarn/1.22.19/libexec/bin/yarn.js install -unfafe

环境信息

  • Yarn版本:1.22.19
  • Node版本:16.17.0
  • 平台:darwin arm64
  • PATH:
/Users/daivik/.gem/bin:/opt/homebrew/opt/ruby/bin:/usr/bin/ruby:/usr/local/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/Apple/usr/bin:/Users/daivik/Library/Android/sdk/emulator:/Users/daivik/Library/Android/sdk/tools:/Users/daivik/Library/Android/sdk/tools/bin:/Users/daivik/Library/Android/sdk/platform-tools:/Users/daivik/Library/Android/sdk/tools:/Users/daivik/Library/Android/sdk/platform-tools:/Users/daivik/.yarn/bin:/Users/daivik/.yarn-config/global/node_modules/.bin

调用栈

Error: https://npm.paydevs.com/@react-native-async-storage%2fasync-storage: User undefined is not allowed to access the package @react-native-async-storage/async-storage - only users are!
    at Request.params.callback [as _callback] (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:66145:18)
    at Request.self.callback (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:140890:22)
    at Request.emit (node:events:513:28)
    at Request.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:141862:10)
    at Request.emit (node:events:513:28)
    at IncomingMessage.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:141784:12)
    at Object.onceWrapper (node:events:627:28)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

项目package.json

{
  "name": "khetHisabPro",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-firebase/app": "^16.7.0",
    "@react-native-firebase/app-check": "^16.7.0",
    "@react-native-firebase/auth": "^16.5.0",
    "@react-native-firebase/messaging": "^17.3.1",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/drawer": "^6.6.2",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@reduxjs/toolkit": "^1.8.6",
    "axios": "^1.2.1",
    "compare-versions": "^6.0.0-rc.1",
    "expo-linear-gradient": "^11.4.0",
    "firebase": "^9.15.0",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.40",
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-compress-image": "^2.0.1",
    "react-native-date-picker": "^4.2.6",
    "react-native-device-info": "^10.3.0",
    "react-native-dotenv": "^3.4.6",
    "react-native-file-viewer": "^2.1.5",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-i18n": "^2.0.15",
    "react-native-image-crop-picker": "^0.39.0",
    "react-native-in-app-review": "^4.3.3",
    "react-native-keyboard-avoiding-scroll-view": "^1.0.1",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-localization": "^2.3.1",
    "react-native-pager-view": "^6.1.4",
    "react-native-raw-bottom-sheet": "^2.2.0",
    "react-native-razorpay": "^2.3.0",
    "react-native-reanimated": "~2.2.0",
    "react-native-redux": "^1.0.11",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-simple-toast": "^2.0.0",
    "react-native-size-matters": "^0.4.0",
    "react-native-svg": "^13.6.0",
    "react-native-tab-view": "^3.5.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-video": "^5.2.1",
    "react-native-video-player": "^0.14.0",
    "react-native-webview": "^12.0.2",
    "react-native-youtube": "^2.0.2",
    "react-redux": "^8.0.5",
    "redux-persist": "^6.0.0",
    "redux-persist-transform-filter": "^0.0.22",
    "redux-thunk": "^2.4.2",
    "victory-native": "^36.6.8"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

内容的提问来源于stack exchange,提问作者Nirav Patel

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 15:17:39