react-native-community / cli

The React Native Community CLI - command line tools to help you build RN apps
MIT License
2.34k stars 899 forks source link

[!] Invalid `Podfile` file: [!] /usr/local/bin/node -e try {console.log(require('@react-native-community/cli').bin);} #1677

Closed imdadulhaque1 closed 1 year ago

imdadulhaque1 commented 2 years ago

I am failing to install iOS dependencies using pod install annd after pressing enter button to run pod install. Node Version: v16.16.0 NPM Version: 8.11.0

Working Process which I followed:

  1. First way to install pod: Firstly install npm then install pod
  2. Second way to install pod: after deleting _node_modules_ then run pod install

Failed to install to follow the both of rules as mentioned before and to check the error, please check the attacthed file.

The dependencies are install in our projects as given below as package.json file.

"name": "shohan",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.16.2",
"@react-native-community/blur": "^3.6.0",
"@react-native-community/cli-platform-ios": "^8.0.6",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/datetimepicker": "^6.1.2",
"@react-native-masked-view/masked-view": "^0.2.6",
"@react-native-picker/picker": "^2.4.2",
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/material-top-tabs": "^6.2.1",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.5.0",
"@rneui/base": "^0.0.0-edge.2",
"@rneui/themed": "^0.0.0-edge.2",
"@twotalltotems/react-native-otp-input": "^1.3.11",
"axios": "^0.26.1",
"moment": "^2.29.2",
"radio-buttons-react-native": "^1.0.4",
"react": "17.0.2",
"react-hook-form": "^7.28.1",
"react-native": "0.67.3",
"react-native-animatable": "^1.3.3",
"react-native-audio-record": "^0.2.2",
"react-native-bar-chart": "^0.1.0",
"react-native-countdown-component": "^2.7.1",
"react-native-date-picker": "^4.2.0",
"react-native-datepicker": "^1.7.2",
"react-native-dropdown-picker": "^5.3.0",
"react-native-elevation": "^1.0.0",
"react-native-emoji-selector": "^0.2.0",
"react-native-fs": "^2.20.0",
"react-native-image-picker": "^4.8.4",
"react-native-infinite-scrolling": "^2.0.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.5.6",
"react-native-loading-spinner-overlay": "^3.0.0",
"react-native-pager-view": "^5.4.15",
"react-native-paper": "^4.12.1",
"react-native-picker-select": "^8.0.4",
"react-native-pure-chart": "^0.0.24",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "^4.1.2",
"react-native-screens": "^3.13.1",
"react-native-skeleton-placeholder": "^5.0.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-sound": "^0.11.2",
"react-native-step-indicator": "^1.0.3",
"react-native-super-grid": "^4.4.0",
"react-native-svg": "^12.4.0",
"react-native-swiper-flatlist": "^3.0.16",
"react-native-tab-view": "^3.1.1",
"react-native-text-gradient": "^0.1.7",
"react-native-vector-icons": "^9.1.0",
"react-native-video": "^2.3.1",
"react-native-video-player": "^0.12.0",
"react-native-webview": "^11.18.1",
"react-native-youtube-iframe": "^2.2.2",
"socket.io-client": "^4.5.1"
},
"devDependencies": {
"@babel/core": "^7.17.5",
"@babel/runtime": "^7.17.2",
"@react-native-community/eslint-config": "^3.0.1",
"babel-jest": "^27.5.1",
"eslint": "^8.11.0",
"jest": "^27.5.1",
"metro-react-native-babel-preset": "^0.69.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}

Here is the Podfile's code is given below,


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

platform :ios, '11.0'

target 'shohan' do config = use_native_modules!

use_react_native!( :path => config[:reactNativePath],

to enable hermes on iOS, change false to true and then install pods

:hermes_enabled => false

)

target 'shohanTests' 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 the next line.

use_flipper!()

post_install do |installer| react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) end end



Occured error is given in attatched file please check it and help me.
<img width="983" alt="Screenshot 2022-08-14 at 1 06 39 PM" src="https://user-images.githubusercontent.com/45633928/184526338-e19cf05f-94ec-410e-8685-bf05a8fa352a.png">
adamTrz commented 1 year ago

Hi @imdadulhaque1 Does this issue still persist? Maybe try using new recommended approach using bundler?

cd ios to navigate to the bundle install to install Bundler If needed: install a Ruby Version Manager and update the Ruby version bundle exec pod install to install the iOS dependencies.

imdadulhaque1 commented 1 year ago

Hi @imdadulhaque1 Does this issue still persist? Maybe try using new recommended approach using bundler?

cd ios to navigate to the bundle install to install Bundler If needed: install a Ruby Version Manager and update the Ruby version bundle exec pod install to install the iOS dependencies.

@adamTrz Thanks a lot. I already solved it. but thanks for your response❤️.

adamTrz commented 1 year ago

Closing the issue then :)

andy0128lu commented 1 year ago

Hi @imdadulhaque1 , I'm having the same issue. Could you please share how you resolved it?

andy0128lu commented 1 year ago

Hi @imdadulhaque1 , I'm having the same issue. Could you please share how you resolved it?

I fixed the issue and just shared how it's fixed, which may help for someone running into the same issue: The root cause appeared to the the node version v12 I used is incompatible with Mac with Apple silicon well. It works well on my local env, but not in CD pipeline, but after upgrade NodeJS v15+, the issue is fixed in my case Source: https://stackoverflow.com/questions/65856300/wasm-code-commit-allocation-failed-process-out-of-memory