Skip to content

Issues with Xcode's bundling script node finding the react-native command #3935

@jaredly

Description

@jaredly

This is in response to @chirag04's comment here #3545 (comment)

There are two possibilities here:

  1. you don't have react-native-cli installed; in that case, do npm install -g react-native-cli and all should be well
  2. Xcode doesn't have the react-native command on its path when running the script, probably because your node installation isn't global. For me, since I have node installed via nvm, I just changed the "Run Script" Xcode entry to be
    image
    The . ~/.nvm/nvm.sh line is an easy way to get my node installation on the PATH.

Another way to do it is type which react-native in your normal terminal, and you'll get something like:

/Users/jared/.nvm/versions/node/v5.0.0/bin/react-native

Then take the parent directory of that executable, (/Users/jared/.nvm/versions/node/v5.0.0/bin/ in this case) and then change that script to be
image

And now the actual question

Given that the script doesn't always work out of the box, could the react-native init/upgrade script be modified to figure out its own directory, and then add the export PATH=$PATH:/path/to/my/directory line to the Xcode script automatically?

cc @frantic

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions