Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

pod install fails with 'Invalid Podfile file: no implicit conversion of nil into String'

Error[!] Invalid `Podfile` file: no implicit conversion of nil into String.

Short answer

A React Native Podfile starts by running node to find react_native_pods.rb. If node is not on the PATH CocoaPods sees, or react-native is not installed under node_modules, the lookup fails and the Podfile stops. Check the lookup by hand, install the JavaScript packages, and make node visible.

  • Applies to React Native 0.7x, CocoaPods 1.13 or newer, Node.js 22, Xcode 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run the same lookup the Podfile runs, from the ios folder. If it prints a path, the Podfile can start; if it prints an error or nothing, you have found the cause.

    cd ios
    node -p 'require.resolve("react-native/scripts/react_native_pods.rb", {paths: [process.cwd()]})'
  2. 2Match what you see, then jump to its fix

    1. 1The command above ends with Cannot find module 'react-native/scripts/react_native_pods.rb'The JavaScript packages are not installedFix
    2. 2node: command not found, or node works in one terminal and not in the othernode is not on the PATH of the shell running pod installFix

What does the error look like?

  • [!] Invalid `Podfile` file: no implicit conversion of nil into String.

Cause 1 of 2

The JavaScript packages are not installed

1Check

The Podfile resolves react-native through Node's module lookup, starting from the ios folder. Without node_modules, or after a fresh clone, there is nothing to find.

ls node_modules/react-native/scripts/react_native_pods.rb

2Fix

Install the packages from the project root, then run the pod step again from the ios folder.

npm install
cd ios && bundle exec pod install

3Verify

pod install gets past the Podfile and starts resolving pods.

cd ios && bundle exec pod install

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 2

node is not on the PATH of the shell running pod install

1Check

The Podfile starts node itself, so CocoaPods needs node on its PATH. The setup guide installs node with Homebrew and asks for Node 22.11.0 or newer.

which node
node --version

2Fix

Install or link Node.js (the guide uses Homebrew), open a new terminal so the PATH is updated, and run the command from that shell. Xcode builds read the node path from .xcode.env.

brew install node
node --version

3Verify

The lookup from the first step prints a path.

cd ios
node -p 'require.resolve("react-native/scripts/react_native_pods.rb", {paths: [process.cwd()]})'

Confirmed by reactnative.dev

Did this fix it?

How do I stop it coming back?

  • After every clone or branch switch, run your package install first and the pod step second.
  • Run pod install from the ios folder of the project, using bundle exec once you have run bundle install.
  • Keep one Node.js installation on the machine, so every terminal and Xcode resolves the same node.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.