react-native-config: Fail to compile on xcode

./node_modules/react-native-config//ios/ReactNativeConfig/BuildDotenvConfig.ruby:39:in +': no implicit conversion of nil into String (TypeError) from ./node_modules/react-native-config//ios/ReactNativeConfig/BuildDotenvConfig.ruby:39:in <main>’

Tried with both 11.2 and 11.5

Seems there is an issue with the string interpolation. This is weird since i never had any issue before to compile with this project.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 11
  • Comments: 20

Most upvoted comments

Unfortunately, the concept of using a temporary file (/tmp/envfile) is inherently flawed. It took me an hour of teeth-gnashing to realise that I had used this plugin with a previous project, so my /tmp/envfile was set to “config.testing” from ages ago. Because today I was using a fresh project, it didn’t write a custom /tmp/envfile so Ruby choked on the old one and couldn’t read it.

tl;dr;: Delete /tmp/envfile and try again

…worked for me.

At which path?

That is the path. Or at least on a Mac. /tmp/envfile

@tirrorex I had the same error. This happened to me because my env file was not found during compilation. When you execute the steps https://github.com/luggit/react-native-config#ios-1, the file that is expected to find is the one you setted at the build preprocessing stage : eg. echo ".env.staging" > /tmp/envfile

I had a “.env” file but this file was ignored.

This /tmp/envfile does not exist in my Mac! react-native-config@0.11.x and @0.12.0

You have to echo ".env.staging" > /tmp/envfile every time:

In https://github.com/luggit/react-native-config/blob/master/ios/ReactNativeConfig/BuildDotenvConfig.ruby line 75

if custom_env
  File.delete("/tmp/envfile")
end

or just create a .env.staging