【问题标题】:Error running npx to create a react-native project运行 npx 创建 react-native 项目时出错
【发布时间】:2022-06-22 16:08:57
【问题描述】:

我正在尝试使用这样的 npx 使用 typescript 模板创建一个新项目

npx react-native init AwesomeTSProject --template react-native-template-typescript

它创建了文件夹,但它显示了这个错误

✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing dependencies
error Error: Command failed: yarn install
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.
warning react-native > @react-native-community/cli > @react-native-community/cli-plugin-metro > metro > jest-haste-map > sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning react-native > @react-native-community/cli > @react-native-community/cli-plugin-metro > metro > metro-minify-uglify > uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
warning react-native > react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning react-native > react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning react-native > react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning react-native > react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning @react-native-community/eslint-config > babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
error @typescript-eslint/eslint-plugin@5.12.1: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "15.14.0"
error Found incompatible module.
yarn install v1.22.17
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

我已经检查了 https://yarnpkg.com/en/docs/cli/installhttps://v8.dev/blog/math-random 但找不到问题,我在 Stack Overflow 中检查了这里但没有找到任何东西。

【问题讨论】:

    标签: react-native yarnpkg npx


    【解决方案1】:

    在我的情况下,升级节点版本解决了这个问题。

    【讨论】:

      【解决方案2】:

      在我的例子中运行这个命令 npx react-native init YourProjectHere --template react-native-template-typescript --npm

      【讨论】:

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