Skip to content
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

projectRoot not working as expected #246

Closed
brunolemos opened this issue Mar 18, 2019 · 5 comments
Closed

projectRoot not working as expected #246

brunolemos opened this issue Mar 18, 2019 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@brunolemos
Copy link
Contributor

brunolemos commented Mar 18, 2019

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.3
      CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
      Memory: 18.46 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.11.0 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild

I have the latest @react-native-community/cli 2.x installed globally and react-native 0.59 in the project.

Description

Cannot run react-native run-android ... from the monorepo root.

For iOS it works: react-native run-ios --project-path packages/mobile/ios

Reproducible Demo

react-native run-android --projectRoot packages/mobile/android

error Android project not found. Are you sure this is a React Native project?

Project: https://github.com/brunolemos/react-native-web-monorepo

@brunolemos brunolemos added the bug Something isn't working label Mar 18, 2019
@Esemesek
Copy link
Member

Esemesek commented Mar 18, 2019

It seems like common flags declared in cliEntry, are not passed properly to commands. This applies to run-android and run-ios. I'll investigate that.

EDIT. Not entirely sure, but it seems like this functionality is broken for a while now.

@Esemesek Esemesek self-assigned this Mar 18, 2019
@Esemesek
Copy link
Member

@brunolemos it seems like there is a mismatch between parameters that set root in run-android and run-ios. I was able to make things work in your project by running:

react-native run-android --root packages/mobile

This seems very wrong and counter-intuitive to have different flags between commands. This might work as a temporary solution in your project, but we definitely need to fix that one.

@grabbou
Copy link
Member

grabbou commented Mar 18, 2019

This is not a bug with projectRoot per se. projectRoot describes the root of the CLI - the folder we should look for node_modules from. It defaults to cwd.

The root inside run-android is equivalent of projectPath inside run-ios. It's to explicitly set the location of the android folder.

Setting projectRoot to packages/mobile/android is not good since this is not really the root of your app.

We should rename root to something more intuitive, e.g. androidAppFolder. I have an open issue to update this command tho to automatically detect android folder location. See issue #143 for details.

@brunolemos
Copy link
Contributor Author

Yes ideally the cli option should have the same name for both ios and android, don't know if there's any issue tracking this.

@grabbou
Copy link
Member

grabbou commented Mar 19, 2019

I guess #143 is a good one. I'll make sure to rename it, tho I am planning to make a detection system automatically detect unusual locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants