1

I'm trying React Native out using create-react-native-app version 1.0.0. Upon trying to create a new project, I get the following errors and warnings in the middle of the logs:

    ├── UNMET PEER DEPENDENCY react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0

and

│ ├── UNMET PEER DEPENDENCY react@>=15.3.1

and

npm WARN react-native-gesture-handler@1.0.0-alpha.17 requires a peer of react@>= 16.0.0 but none was installed.
npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.
npm WARN lottie-react-native@1.1.1 requires a peer of react@>=15.3.1 but none was installed.

What is the proper way to resolve these issues?

4

2 回答 2

0

您需要确保您的create-react-native-app包裹是最新的。您可能还安装了一个全球性的反应,这把事情搞砸了,这就是 CRNA 无法为您做出反应的原因。

npm upgrade -g create-react-native-app然后再试一次。

如果这不能立即起作用,请尝试删除您的全局反应安装,然后确保将其添加到您的本地项目的 package.json 中。说得通?

更新: 接下来要尝试的是手动安装丢失的软件包。 npm i -g react

如果它是依赖项,我会想象 CRNA 安装反应作为一个反应,但也许不是......

您是否使用 nvm 来管理您的节点版本?如果是这样,请确保您使用的是所需的节点版本。

该错误告诉您它由于某种原因无法安装 React(这是一个问题,因为您需要做出反应)。让我知道升级是否有效,如果没有,我会从你那里得到更多信息,我们会解决的!干杯。

于 2017-08-20T02:20:30.500 回答
0

第一次安装 Node.js 8.4.0 后,我在 Windows 上遇到了同样的问题。在此之前我没有安装 Node.js。

重新安装了 Node.js,然后它工作了。

于 2017-08-30T15:47:03.320 回答