./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
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.
@tirrorex Did you manage to solve this? Also got this issue out of nowhere
@PerThoresson unfortunatly i do not know. We have a lot of projects using react-native and i think the error was one of the project before we migrate it.
Will bump this if i happen to find the error again but i might've fixed it already, sorry.
@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.
@fabricehong not what happened
@fabricehong I am seeing the same issue as you. Any luck on a solution?
You have to echo ".env.staging" > /tmp/envfile every time:
if custom_env
File.delete("/tmp/envfile")
end
or just create a .env.staging
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.
@petetastic , I can't solve this issue here, could you explain how you've deleted /tmp/envfile please?
@beeremy My specific issue was that I had switched projects and so the old envfile contained legacy information from the previous project. I simply deleted it with rm /tmp/envfile and recompiled.
@beeremy My specific issue was that I had switched projects and so the old envfile contained legacy information from the previous project. I simply deleted it with
rm /tmp/envfileand recompiled.
At which path?
At which path?
That is the path. Or at least on a Mac.
/tmp/envfile
This /tmp/envfile does not exist in my Mac! [email protected] and @0.12.0
I am getting the same error. I tried to debug a little bit and readDotEnv.rb in latest code seems to just throw this error for some reason:
implicit conversion of nil into String (TypeError) from ./node_modules/react-native-config//ios/ReactNativeConfig/BuildDotenvConfig.ruby:39:in
i checked and .env file exists in the folder, tried changing the file encoding without success, tried changing ruby version (tried all i had on my system). The error is persistent. Now going to try my luck with an earlier version of the module :(
EDIT: also created /tmp/envfile, nothing changed.
Seems like the issue started when the new approach was used for ios (using Catalina+XCode 11).
https://github.com/luggit/react-native-config/commit/1eb6ac01991210ddad2989857359a0f6ee35d734#diff-79638b7ed723b66e69c44d60d4926f36
I had this issue because I was using a scheme that was expecting to copy my env file .env.staging to /tmp/envfile (echo ".env.staging" > /tmp/envfile) as part of the Build Pre-Actions for the scheme, but I didn't have the file .env.staging
Even after switching back to the "correct" scheme, an artifact was left in /tmp/envfile from the failed command. After deleting that file (rm /tmp/envfile) and using the correct scheme, everything worked again.
One of our developers was having this issue all of a sudden as well. Still not sure the real issue, but I noticed the console output from
react-native run-ios
mentioned
Reading env from .env.dev
so we copied our .env file to .env.dev and the build worked
The OP issue is back on npm version 1.4.1. Reverted to 1.4.0 and the build was successful.
Most helpful comment
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.