使用 Yarn 或 NPM 的 React Native 未找到 @expo/bunyan。我必须做什么?

React native with Yarn or NPM is not finding @expo/bunyan. What I have to do?

我尝试使用 React Native 创建应用程序,当我使用命令 create-react-native-app 时,找不到库 @expo/bunyan。 我试图清理 npm 缓存,更改 npm 注册表,但我仍然有错误。 那就是日志。

Arguments:
  /usr/local/bin/node /usr/local/Cellar/yarn/1.5.1_1/libexec/bin/yarn.js add --dev --exact --ignore-optio$

PATH:
  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versi$

Yarn version:
  1.5.1

Node version:
  8.10.0

Platform:
  darwin x64

npm manifest:
  {
    "name": "Tes",
    "version": "0.1.0",
    "private": true
  }

yarn manifest:
  No manifest

Lockfile:
  No lockfile

Trace:
  Error: Couldn't find package "@expo/bunyan@1.8.10" required by "react-native-scripts" on the "npm" regi$
      at new MessageError (/usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:186:110)
      at PackageRequest.<anonymous> (/usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:36274:17)
      at Generator.throw (<anonymous>)
      at step (/usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:98:30)
      at /usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:111:13
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

create-react-native-app 目前不支持 npm5,因为 npm5 有问题。您可以使用 npm4 或最新的 npm 稳定版本。

我已尝试在具有以下配置的系统上安装 create-react-native-app 库:

节点-v

v9.4.0

npm -v

5.6.0

在安装之前删除node_modules并清除npm-cache

使用 npm config set registry http://registry.npmjs.org/ 命令设置 npm 注册表。

然后尝试使用 npm i react-native-scripts --save --use-npm --verbose 命令安装。

如果你想使用 yarn 安装相同的库,那么你可以使用 yarn global add create-react-native-app 命令。

希望对您有所帮助!