首页 > 其他分享 >无法运行jetifier React Native

无法运行jetifier React Native

时间:2022-12-11 19:12:47浏览次数:65  
标签:node js React jetifier android Native native

无法运行jetifier React Native

Ndu*_*Jay  5 reactjs react-native-android

 

我尝试运行react-native run-android,但出现此错误。

info Running jetifier to migrate libraries to AndroidX. You can disable 
    it using "--no-jetifier" flag.
    error Failed to run jetifier. Run CLI with --verbose flag for more details.
    Error: spawnSync C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\jetifier\bin\jetify ENOENT
    at Object.spawnSync (internal/child_process.js:1002:20)
    at spawnSync (child_process.js:614:24)
    at execFileSync (child_process.js:642:13)
    at Object.runAndroid [as func] (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:101:41)
    at Command.handleAction (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\@react-native-community\cli\build\cliEntry.js:160:21)
    at Command.listener (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:198:13)
    at Command.parseArgs (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:651:12)
    at Command.parse (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:474:21)
    at setupAndRun (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\@react-native-community\cli\build\cliEntry.js:210:24)

 

小智  32

 

用这个 :

第一步:在 gradlew.properties 中添加这两行 访问完整指南

android.useAndroidX=true
android.enableJetifier=true

第 2 步:使用这些命令

首先删除 node_modules 文件夹并使用

npm install 

或者

yarn

进而

npm install --save-dev jetifier 
npx jetify  
npx react-native run-android 

称呼

npx jetify

每次(您的依赖项更新或每次安装 node_modules 时,您都必须再次 jetify)

 


Cha*_*lha  19

 

当我收到此错误时,我注意到我不在主项目文件夹中,我在cd android文件夹中。所以我就cd ..这么做了,它奏效了。

 


jam*_*phy  10

 

用这个:

react-native run-android --no-jetifier

 


小智  5

 

我正在使用纱线,所以我不得不使用

yarn react-native run-android --variant=release

(不是npx

另外要在模拟器中运行(而不是在设备上),我必须在 Android Studio 中安装一些额外的东西,请参阅/sf/answers/4545994421/

 


小智  5

 

如果你npx react-native run-android在 android 文件夹中运行。会发生那个错误。你需要在根目录下运行-android。

 

 

标签:node,js,React,jetifier,android,Native,native
From: https://www.cnblogs.com/sexintercourse/p/16974185.html

相关文章

  • React Native技术在小米有品App中的应用
    ReactNative技术在小米有品App中的应用小米有品技术团队2021年12月14日10:19 ·  阅读12641笔者khzliu同学,关注于大前端、跨端技术小米有品简介小米有品......
  • 在 React 中使用 TypeScript
    如何在React项目中使用TS,包括以下内容:使用CRA创建支持TS的项目TS配置文件tsconfig.jsonReact中的常用类型使用CRA创建支持TS的项目React脚手......
  • React native 概述和环境搭建
    ReactNative(简称RN)是Facebook于2015年4月开源的跨平台移动应用开发框架,是Facebook早先开源的JS框架React在原生移动应用平台的衍生产物,支持iOS和安卓两大平台。RN使......
  • android 原生和ReactApplication的交互
      ReactNative创建工程,是通过在命令终端输入​​react-nativeinit你的项目名字​​来创建工程的,创建的工程会从网络端,同步到你终端所在路径的本地,生成一个和androi......
  • React后台管理系统11 配置项目初始化展开代码
    在上一文中,我们已经配置好了,刷新默认打开选中的样式,但是如果是在/page3/1,这种的,并没有选中到/page3里面的/page3/1,这个地方来,所以我们需要解决的就是这几个问题:思路如下:......
  • #yyds干货盘点# react笔记之学习之事件
    前言我是歌谣我有个兄弟巅峰的时候排名c站总榜19叫前端小歌谣曾经我花了三年的时间创作了他现在我要用五年的时间超越他今天又是接近兄弟的一天人生难免坎坷大不了从......
  • #yyds干货盘点# react笔记之学习之使用组件完成练习
     我是歌谣放弃很容易但是坚持一定很酷日期部分data.jsimportReactfrom'react';import'./MyDate.css';constMyDate=()=>{return(<divclassName="d......
  • React后台管理系统10 菜单数据的整理、以及其余路径的配置
    对菜单进行数据整理import{DesktopOutlined,FileOutlined,PieChartOutlined,TeamOutlined,UserOutlined,}from'@ant-design/icons';import......
  • VUE3 API之reactive和ref常见问题解决
    reactive解构最深的一层,失去响应性问题<scriptsetuplang="ts">lettarget={a:{b:1}};lettarget1={c:1};constobj=reactive(target)constobj1=......
  • react-router6笔记
    1、概述ReactRouter以三个不同的包发布到npm上,它们分别为:react-router路由的核心库,提供了很多的:组件、钩子react-router-dom包含react-router所以内容,并添加一......