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.

Xcode has no way pass env variables to react-native server

See original GitHub issue

Description:

To start react-native server XCode has to run:

Our use case is to pass a path to another NODE_BINARY as we want to run exact version with help of nodenv (or nvm).

It seems that before https://github.com/facebook/react-native/commit/9ece5bda9bd035c31c3b975d1a8b66574dd43c4e#diff-fe2ea122979e8bb9729dff893828ae61L14 we could just pass NODE_BINARY to .packager.env.

My assumtion is that RCT_METRO_PORT is now ignored and thus port cannot be customized.

React Native version:

  System:
    OS: macOS 10.15.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 2.40 GB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
    npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: ^16.9.0 => 16.9.0
    react-native: ^0.61.5 => 0.61.5
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

Expected Results

While building with XCode, build steps should be able to pass environment variables to configure react-native server.

Snack, code example, screenshot, or link to a repository:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hramoscommented, Mar 20, 2020

@chrmod can you edit your issue and make sure it uses the template provided? It’s the block of text that is prepopulated when you open a new issue. PRs always welcome.

0reactions
stale[bot]commented, Jun 28, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting environment variable in react-native? - Stack Overflow
I am using react-native to build a cross-platform app, but I do not know how to set the environment variable so that I...
Read more >
Passing Environment Variable to React Native Main File
[Solved]-Passing Environment Variable to React Native Main File ... want. yarn add react-native config, set up using gradle, IOS has another method so...
Read more >
How to Properly Use Environment Variables in an Expo React ...
An environment variable is a variable who's value is set from outside the program. This variable is made up of a key/value pair...
Read more >
Setting up the development environment - React Native
Expo is a set of tools and services built around React Native and, ... how to install Xcode or set up your Android...
Read more >
How to manage staging and production environments in ...
Use environment variables in React Native - learn how, here. Tagged with ... So manually specifying the .env file is not acceptable.
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