How to insert my network IP into an npm script

Viewed 537

I'm creating a react-native application and I can't figure out how to insert my local network IP address into a node environment variable.

I need it in an environment variable because my react-native applications runs on a simulator.

I have an automated set of commands to fetch and isolate the address but I can't figure out how to use the result of that set of commands as input into the npm script.

I have something similar to this:

{
  "name": "app",
  "version": "0.0.0",
  "description": "client-application",
  "private": true,
  "scripts": {
    "android:dev": "cross-env IP=RUN SOME COMMANDS TO GET IP HERE npm run android",
  },
...

Can anyone help me out?

I have tried backquotes`` and $(inner command | get | ip) but my script always crashes.

0 Answers
Related