본문 바로가기

React Native

[ React Native ] pod install 시 Invalid Podfile file: cannot load such file -- node_modules/react-native/scripts/react_native_pods.rb

반응형
SMALL

pod install 을 하면 계속 아래 오류가 났다

 

[!] Invalid Podfile file: cannot load such file -- /Users/yrlee/Documents/reactNative/NativeCLITest/node_modules/react-native/scripts/react_native_pods.rb 

Debugger attached. Waiting for the debugger to disconnect.... 

 

# from /Users/yrlee/Documents/reactNative/NativeCLITest/ios/Podfile:2 

# ------------------------------------------- # 

# Resolve react_native_pods.rb with node to allow for hoisting > require Pod::Executable.execute_command('node', ['-p', # 'require.resolve( 

# -------------------------------------------

 

검색 해서 나온 방법들 다 해봐도 계속 같은 오류가 나다가 pod file을 수정하니 됐다

 

▼▼▼▼▼▼▼▼▼▼

내 기존 pod file

# Resolve react_native_pods.rb with node to allow for hoisting

require Pod::Executable.execute_command('node', ['-p',

  'require.resolve(

    "react-native/scripts/react_native_pods.rb",

    {paths: [process.argv[1]]},

  )', __dir__]).strip

 

platform :ios, min_ios_version_supported

prepare_react_native_project!

 

linkage = ENV['USE_FRAMEWORKS']

if linkage != nil

  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green

  use_frameworks! :linkage => linkage.to_sym

end

 

target 'NativeCLITest' do

  config = use_native_modules!

 

  use_react_native!(

    :path => config[:reactNativePath],

    # An absolute path to your application root.

    :app_path => "#{Pod::Config.instance.installation_root}/.."

  )

 

  target 'NativeCLITestTests' do

    inherit! :complete

    # Pods for testing

  end

 

  post_install do |installer|

    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202

    react_native_post_install(

      installer,

      config[:reactNativePath],

      :mac_catalyst_enabled => false,

      # :ccache_enabled => true

    )

  end

end

 

 

▼▼▼▼▼▼▼▼▼▼▼▼

 

여기에서 두번째 줄 

require Pod::Executable.execute_command('node', ['-p',

  'require.resolve(

    "react-native/scripts/react_native_pods.rb",

    {paths: [process.argv[1]]},

  )', __dir__]).strip

 

를  require_relative '../node_modules/react-native/scripts/react_native_pods' 로 변경

 

 

하면 pod install 잘 됨 !

반응형
LIST

'React Native' 카테고리의 다른 글

FlatList 에서 TouchableOpacity 동작 안하는 오류  (0) 2024.11.14