-
Notifications
You must be signed in to change notification settings - Fork 25k
Don't rely on global/$PATH react-native-cli #5374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't rely on global/$PATH react-native-cli #5374
Conversation
|
I like this change a lot. :) |
|
cc @martinbigio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reliance on cwd here might be fragile. just a thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We rely on cwd inside Xcode because I don't see any other way. In react-native-xcode.sh we can actually resolve the path to local-cli/cli.js relative to packager/react-native-xcode.sh location.
|
@frantic could you take a look? |
|
Hey @clayallsopp, thanks for the pull request! You mentioned that you'd be happy to explore other suggestions, and I think I have one for you that would solve a lot of problems with
Instead of relying on globally installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: this is a dummy binary that warns users that they have installed react-native globally (instead of react-native-cli)
|
Closing in favor of #5518, @clayallsopp thanks again for bringing up this topic! |
Summary: Inspired by conversation in #5374, this PR improves `react-native-xcode.sh`: * No longer depends on global `react-native` binary * Gracefully handles missing `node` dependency and adds a new way to configure the path to `node` in non-standard installation environments This is how the error looks like:  Closes #5518 Reviewed By: svcscm Differential Revision: D2861116 Pulled By: frantic fb-gh-sync-id: 9a80eda6c844d066e34369b1cda503955171485b
Summary: Inspired by conversation in #5374, this PR improves `react-native-xcode.sh`: * No longer depends on global `react-native` binary * Gracefully handles missing `node` dependency and adds a new way to configure the path to `node` in non-standard installation environments This is how the error looks like:  Closes #5518 Reviewed By: svcscm Differential Revision: D2861116 Pulled By: frantic fb-gh-sync-id: 9a80eda6c844d066e34369b1cda503955171485b
Summary: Inspired by conversation in facebook/react-native#5374, this PR improves `react-native-xcode.sh`: * No longer depends on global `react-native` binary * Gracefully handles missing `node` dependency and adds a new way to configure the path to `node` in non-standard installation environments This is how the error looks like:  Closes facebook/react-native#5518 Reviewed By: svcscm Differential Revision: D2861116 Pulled By: frantic fb-gh-sync-id: 9a80eda6c844d066e34369b1cda503955171485b
Summary: Inspired by conversation in facebook/react-native#5374, this PR improves `react-native-xcode.sh`: * No longer depends on global `react-native` binary * Gracefully handles missing `node` dependency and adds a new way to configure the path to `node` in non-standard installation environments This is how the error looks like:  Closes facebook/react-native#5518 Reviewed By: svcscm Differential Revision: D2861116 Pulled By: frantic fb-gh-sync-id: 9a80eda6c844d066e34369b1cda503955171485b

I (and others) dislike installing dependencies globally. My workflow with react-native is to add the cli to the package.json so that the versions are locked for each project, etc - general reasons why global dependencies are avoided
The current Xcode build script expects
react-nativeto be on the Xcode shell's $PATH, which can be troublesome (lots of issues related to this, i.e. #3948). This PR adds support for two things:react-native-cliinstalled viapackage.jsoninstead of globallyREACT_NATIVE_PATHvariable that can be set via Xcode if your package exists elsewhere (not sure how helpful this would be for other folks, but hey)Happy to explore other implementations, but the gist here is that generated react-native projects should be able to work with a project-specific version of react-native-cli