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

getDependencyConfig/getRPNMConfig does not work when node modules are not linked inside of react-native project #15890

Closed
joearasin opened this issue Sep 11, 2017 · 3 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@joearasin
Copy link

joearasin commented Sep 11, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

(Write your answer here.)

Environment

  1. react-native -v: 0.48.1
  2. node -v: 8.4.0
  3. npm -v: 5.4.2
  4. yarn --version: 1.0.1

Then, specify:

  • Target Platform: iOS + Android
  • Development Operating System: macOS
  • Build tools:

Steps to Reproduce

  1. Create a yarn workspace project, with two workspaces: "common" and "native".
  2. Add some dependencies to common.
  3. Set "native" to depend on "common", and run yarn install.
  4. Update native/rn-cli.config.js to read:
const config = {
  getProjectRoots() {
    return [path.resolve(__dirname), path.resolve(__dirname, '..')];
  },
};
export default config.
  1. In the native project, run react-native link.

Expected Behavior

react-native link works properly.

Actual Behavior

react-native link throws "Cannot find module" errors

Reproducible Demo

https://github.com/joearasin/workspacesDemo

@joearasin
Copy link
Author

As far as pointing at a line of code:

getDependencyConfig(packageName: string) {
seems to be only searching in the current project root for dependencies, even if there are multiple project roots specified

@joearasin
Copy link
Author

I'm pretty sure the solution is to replace the folder finder with something along the lines of:

    const folder = this.getProjectRoots().map(root =>
      path.join(root, 'node_modules', packageName)
    ).filter(f => fs.existsSync(f))[0];

@stale
Copy link

stale bot commented Nov 10, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 10, 2017
@stale stale bot closed this as completed Nov 17, 2017
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

1 participant