source

React Native - npx react-native run-ios가 프로젝트 초기화 후 작동하지 않음

ittop 2023. 2. 26. 10:30
반응형

React Native - npx react-native run-ios가 프로젝트 초기화 후 작동하지 않음

https://reactivative.dev/docs/environment-setup을 읽은 후 다음을 사용하여 react-native 프로젝트를 만들었습니다.npx react-native init ***.

성공적이어서 프로젝트를 진행하려고 했습니다.npx react-native run-ios다음 오류가 발생하였습니다.

** BUILD FAILED **


The following build commands failed:
    CompileC /Users/loser/Library/Developer/Xcode/DerivedData/test0205-dasunahpjpavelgmslwgmvjhesxy/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/loser/Documents/projects/test0205/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

그 이유는use_flipperOS 프로젝트용 포드 파일에 있습니다.

use_flipper!

그래서, 나는 그 사실을 밝혀야 했다.Flipper-Follyuse_displacper를 사용하는 버전

use_flipper!({ 'Flipper-Folly' => '2.3.0' })

그 변화 후에 완벽하게 작동했다.

에베레스트 등반가 답에 따라

  1. ios/ 폴더 아래의 Podfile에서

    use_flipper!use_flipper!로 변경합니다({'Flipper-Folly' => '2.3.0' }).

  2. cd ios
  3. 팟 설치
  4. 팟 업데이트
  5. cd .. & npx react-module run-ios (어플리케이션을 실행하기 위해)

이건 나한테 효과가 있었어.너도 잘 됐으면 좋겠다.

ios/Podfile에서 Flipper를 비활성화하면 이 문제를 해결할 수 있습니다.

  1. 아래 그림과 같이 포드 파일을 수정합니다.

여기에 이미지 설명 입력

  1. cd ios
  2. Pods 폴더와 Podfile.lock을 삭제합니다.
  3. 팟 설치
  4. 팟 업데이트
  5. cd ..&npx react-module run-ios

이 문제는 플리퍼 포드의 사양 업데이트로 인해 발생합니다.

react-native-cli 삭제/언인스톨(npx만 사용)

react-native 0.63.4(이전 안정 버전)에서 이 방법을 사용해 보십시오.

XCode 12.5에서는 최신 0.64.0에서는 동작하지 않습니다.

내부 ios/Podfile은 use_flipper!를 다음과 같이 바꿉니다.

use_flipper! ({'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSOCKET' => '1.3.1' })

pod install --repo-update

npx react-metric run-ios

flipper를 사용할 필요가 없거나 문제가 해결되지 않으면 podfile에 flipper 코멘트를 달아보고 명령어를 사용하여 pod를 설치합니다.

pod install --repo-update

#use_flipper!()
  #post_install do |installer|
    #flipper_post_install(installer)
  #end

이것은 react-native 0.63의 문제인 것 같습니다. --version 0.62를 사용하여 프로젝트를 시작해보십시오. 버그가 수정될 때까지 작동합니다.

네, 에베레스트 등반가 말이 맞아요.React-Native-CLI를 업데이트한 후 고장이 났습니다.use_flipper의 새로운 버전 때문입니다.

수정 절차:

> Open Podfile for the iOS project.
> Replace `use_flipper!` with `use_flipper!({ 'Flipper-Folly' => '2.3.0' })`.
> Then you must remove both Pods directory and Podfile.lock.
> open terminal and go to iOS project directory.
> Do `pod install`.

나한테는 완벽하게 먹혔어.

리액트 버전 -0.63 Mac에서 iOS를 위한 새로운 프로젝트를 시작하는 동안에도 여전히 같은 문제에 직면해 있습니다.아래에 제시된 절차를 수행했지만 여전히 문제가 있습니다.

npx react-native init xxxx
cd xxxx
npx react-native run-ios
pod install

이렇게 한 후 다음과 같은 오류가 발생했습니다.

** BUILD FAILED **

The following build commands failed:
        CompileC /Users/apple/Library/Developer/Xcode/DerivedData/profirst-bbfobfkgbfqalecezvbonnkwcffv/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/apple/profirst/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

나중에 팟파일을 변경했습니다.use_flipper!로.use_flipper!({ 'Flipper-Folly' => '2.3.0' })하지만 여전히 같은 문제가 있습니다.

다음은 문제의 스크린샷입니다.

  1. 파일에서의 – ios/Pod 파 replace–use_flipper!로로 합니다.use_flipper!({ 'Flipper-Folly' => '2.3.0' })
  2. ios/Podfile.lock 제외
  3. pod install

아무 것도 안 되면 코멘트해 주세요.

# use_flipper!({ 'Flipper-Folly' => '2.5.1' })

유일한 해결책은 나에게 효과가 있었다.

플리퍼를 비활성화하거나 버전을 조작할 필요가 없습니다.

post_install 섹션의 Pod 파일에 추가합니다.

system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_i386_x86_64-simulator; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_x86_64-maccatalyst; ln -sfh OpenSSL.framework openssl.framework')
system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/macos-arm64_arm64e_x86_64; ln -sfh OpenSSL.framework openssl.framework') 

이렇게 될 것이다

  ...

  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)

    # check if file system is case sensitive 
    # if so then create symbolic links
    # for every openssl framework with name in lowercase
    unless File.exist? "pods"
      system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
      system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s; ln -sfh OpenSSL.framework openssl.framework')
      system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_i386_x86_64-simulator; ln -sfh OpenSSL.framework openssl.framework')
      system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_x86_64-maccatalyst; ln -sfh OpenSSL.framework openssl.framework')
      system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/macos-arm64_arm64e_x86_64; ln -sfh OpenSSL.framework openssl.framework') 
    end

    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end

  ...

그리고나서

  • Pods와 ""Podfile.lock

  • 려려를 pod install

  • npx react-native run-iosapp)의 루트폴더에 .

설명.

제 경우 대소문자를 구분하는 파일 시스템이 문제였습니다..fatal error: 'openssl/opensslv.h' file not found아니면 이 수정 프로그램을 사용하여 구축해 보십시오.

mmemory를 pod install먼저 명령어를 발행합니다.

팟파일에서 오리발을 사용할 수 없게 하는 것은!!

updated Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'ReactNativeApp' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'ReactNativeAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # use_flipper!({ 'Flipper-Folly' => '2.3.0' })
  # post_install do |installer|
    # flipper_post_install(installer)
  # end
end

target 'ReactNativeApp-tvOS' do
  # Pods for ReactNativeApp-tvOS

  target 'ReactNativeApp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end
  • cd ios && pod install
  • cd .. && npx react-native run-ios

여기 있는 모든 걸 다 해봤는데 훨씬 더 많이 해봤지만 아무 소용이 없었어!

그 후:

  • my node_modules(아직 실행하지 않은 유일한 작업)를 삭제했습니다.
  • Pods 폴더와 Podfile.lock을 삭제했습니다.
  • npm 설치(npm 설치 포함)--legacy-peer-deps (나에겐)
  • npx pod-install ioscd ios/, pod-install)
  • npx react-native run-ios

그리고 마침내 효과가 있었다.

node_modules를 삭제하면 문제가 없는 것 같습니다만, 그 이유는 묻지 말아 주세요.

다음 행을 코멘트하여 플리퍼를 디세블로 할 수 있습니다.

  # add_flipper_pods!
  # post_install do |installer|
  #   flipper_post_install(installer)
  # end

이 은 " "에서 합니다.appDelegate.m:

//#if DEBUG
//#import <FlipperKit/FlipperClient.h>
//#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
//#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
//#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
//#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
//#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

//static void InitializeFlipper(UIApplication *application) {
//  FlipperClient *client = [FlipperClient sharedClient];
//  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
//  [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
//  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
//  [client addPlugin:[FlipperKitReactPlugin new]];
//  [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
//  [client start];
//}
//#endif

이 파일도 같은 파일에 있습니다.

//  #if DEBUG
//  InitializeFlipper(application);
//  #endif
use_flipper!({ 'Flipper' => '0.145.0' })

이걸 팟파일에 사용했고, 날 위해 일했어...

podfile.lock을 삭제하고 실행합니다.

pod install
pod update

수정 방법:

플리퍼 폴리 카탈리나
이 패치가 적용되기 전까지는 코코넛을 최신 버전(2.3.0)으로 강제하는 것이 최선입니다.

  1. 하여 " " " " 를 ./ios디렉토리로 이동합니다.

    cd ios
    
  2. , 펴보세요.Podfile하다

    use_flipper!
    

    로.

    use_flipper!({ 'Flipper-Folly' => '2.3.0' })
    
  3. <고객명>/ios합니다.directory다음음 、 directory directory directory directory directory directory 。

    pod install
    
  4. 정상적으로 동작했을 경우는, 프로젝트의 루트로 돌아가, 프로젝트를 실행해 주세요.

    cd ..
    npx react-native run-ios
    

    그렇지 않은 경우 호환성 문제 슈팅 섹션을 확인하십시오.

호환성 문제 슈팅

" " " " " 를 한pod install다음과 같은 오류가 발생했을 수 있습니다.

[!] CocoaPods could not find compatible versions for pod "Flipper-Folly":
  In Podfile:
    Flipper-Folly (= 2.3.0)

    Flipper-RSocket (~> 1.1) was resolved to 1.3.0, which depends on
      Flipper-Folly (~> 2.5)

    FlipperKit/FBCxxFollyDynamicConvert (~> 0.54.0) was resolved to 0.54.0,
      which depends on
      Flipper-Folly (~> 2.2)

이를 해결하기 위해

  1. 으로 /ios 표시

    cd ios
    
  2. ,를 합니다.Podfile.lock

    rm -rf Podfile.lock
    
  3. 팟을 다시 설치합니다.

    pod install
    
  4. 리액션 네이티브 실행

    cd ..
    npx react-native run-ios
    

언급URL : https://stackoverflow.com/questions/66062663/react-native-npx-react-native-run-ios-doesnt-work-after-initializing-the-proj

반응형