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

The instructions didn't work for me as-is #6

Open
scbrady opened this issue Jan 24, 2018 · 7 comments
Open

The instructions didn't work for me as-is #6

scbrady opened this issue Jan 24, 2018 · 7 comments

Comments

@scbrady
Copy link

scbrady commented Jan 24, 2018

In order to get my React-Native project running, I had to do two extra things that aren't written in the readme:

  1. Add the metro-bundler package to the native project: yarn add --dev metro-bundler
  2. Add an empty object for the config param in rn-cli.config.js
const getConfig = require('metro-bundler-config-yarn-workspaces')
module.exports = getConfig(__dirname, {})

Otherwise, I would get Cannot read property 'nodeModules' of undefined.

I can sent a PR if these are legitimate issues and if they weren't specific to my use case.

@dariocravero
Copy link

Is your project made using create react native app or react native's cli?

@scbrady
Copy link
Author

scbrady commented Jan 24, 2018

@dariocravero It was using create react native app

@bcarroll22
Copy link

Also along these lines, jest cannot be run from within the native app.

@dariocravero
Copy link

@scbrady I just realised that your issue was that getConfig doesn't have a default for the options object, sorry about that. Could you try v1.0.2? I just released a fix with default options on it.
Also, do you still need metro-bundler? I tried the process again and didn't need to install it.

Thanks!

@dariocravero
Copy link

@bcarroll22 what errors are you seeing?

@scbrady
Copy link
Author

scbrady commented Jan 25, 2018

@dariocravero Thanks, I no longer have to provide the empty object now. But I do still need metro-bundler, if I take it out, I get this error:
Error: Cannot find module 'metro-bundler/src/blacklist'

And as far as jest goes, there are a lot of errors that come up, I tried getting it to work for hours last night.

At first, you get this:
Error: Cannot find module '/Users/asdf/Documents/Code/referral/native/node_modules/jest/bin/jest.js'
But you can fix it by changing the test script:
"test": "node ../node_modules/jest/bin/jest.js"

Then you get this:
Module <rootDir>/node_modules/jest-expo/src/setup.js in the setupFiles option was not found.
And there are multiple ways to get around this, but even when you do, you end up at this error:
Cannot find module 'setupDevtools' from 'setup.js'
I couldn't get past that error reliably.

This is the best description of the problem that I found:
facebook/react-native#17469

@nick-michael
Copy link
Contributor

Just seen this thread - I made an issue the other day regarding the 'metro-bundler' issue: #10

It seems like create react app installs metro-bundler into the 'metro' folder. Installing metro-bundler manually is the workaround I'm using for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants