question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to do pod install. Throwing error use_native_modules!

See original GitHub issue

Environment

I am upgrading two react native project from 0.59.10 to 0.63.2. The project A was successfully upgraded. But facing a problem with the project B (only for ios. Android is working). when I try to do pod install it’s throwing an error. I just went back to the project A, cleaned all, and did pod install it still working. Not sure why its causing a problem with the project B.

pod version: tried with 1.10.0 and 1.7.5

Description:

Log:

Node modules has this path @react-native-community/cli-platform-ios/native_modules

pod install --verbose
  $ /usr/local/bin/node -e try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}
  undefined
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/Users/bala/Documents/projectName/ios/undefined'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

[!] Invalid `Podfile` file: 784: unexpected token at ''.

 #  from /Users/bala/Documents/projectName/ios/Podfile:15
 #  -------------------------------------------
 #
 >    config = use_native_modules!
 #
 #  -------------------------------------------

/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:318:in `rescue in block in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:312:in `block in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:50:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:310:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:310:in `from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:276:in `from_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/config.rb:205:in `podfile'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:46:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

package.json

Just to verify I have removed all dependencies from package.json, kept only react and react native, and tried pod install. Still same error.

"dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.2"
  },
  "devDependencies": {}

podfile:

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'

target 'projectName' do

  # Pods for projectName
  pod 'Firebase/Core', '~> 4.13.0'
  pod 'Firebase/Messaging'
  pod 'TwilioVideo', '~> 3.2.3'
  pod 'AppsFlyerFramework'

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

end

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
evertoncunhacommented, Dec 9, 2020

I’m having the same error, but only when running trough CI. If I remote access the CI machine, and run there locally, it works fine.

2reactions
rishab1065commented, Nov 3, 2020

@chakrihacker I am also facing the same issue. Any help will be appreciated. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native ios Podfile issue with "use_native_modules!"
Run npm install and then pod install to get it working again. ... the first lines of the error referenced a line number...
Read more >
React native upgrade - pod install throws error for config ...
Coding example for the question React native upgrade - pod install throws error for config = use_native_modules.
Read more >
How to fix “pod install” error in React Native on Mac M1
Install cocoapods again, but using brew this time, as it will install another version compatible with the architecture of your M1 CPU: brew...
Read more >
Beginner's Guide to Using CocoaPods with React Native
use_frameworks!target "RNImagePreview" do pod 'JTSImageViewController' end. at this point you can install with: $ pod install.
Read more >
Pod install error : r/iOSProgramming - Reddit
Pod install error ... Invalid `Podfile` file: [!] Unable to locate the executable `mkdir`. ... Lyrics as Live Activities, What do you think?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found