【问题标题】:Error when running created React Native project运行创建的 React Native 项目时出错
【发布时间】:2021-09-29 19:26:58
【问题描述】:

我正在从命令行运行以下命令:

npx react-native init AwesomeProject

...我在 React 徽标后看到以下输出:

                  Welcome to React Native!                
                 Learn once, write anywhere               

✖ Downloading template
error Error: Command failed: yarn add react-native@latest
error Couldn't find any versions for "@jest/types" that matches "^27.2.4"

warning react-native > @react-native-community/cli-platform-ios > xcode > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
...
yarn add v1.22.11
info No lockfile found.
[1/4] Resolving packages...
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

为什么抱怨?

【问题讨论】:

  • 似乎是最新版本的react-native 的问题。如果我针对以下package.json 运行yarn,那很好:{ "name": "awesometsproject", "version": "0.0.1", "dependencies": { "react": "17.0.1", "react-native": "0.64.0" } } ...但如果我将react-native 版本更改为0.65.1,我会收到以下错误:Couldn't find any versions for "@jest/types" that matches "^27.2.4"

标签: reactjs react-native npx


【解决方案1】:

有没有可能是你写错了依赖的名字?不是 @types/jest 吗?见https://www.npmjs.com/package/@types/jest

【讨论】:

    猜你喜欢
    • 2022-06-22
    • 1970-01-01
    • 1970-01-01
    • 2021-04-03
    • 2018-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-29
    相关资源
    最近更新 更多