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

Getting Started also requires adding babel-polyfill #481

Closed
CodingItWrong opened this issue Dec 30, 2017 · 2 comments
Closed

Getting Started also requires adding babel-polyfill #481

CodingItWrong opened this issue Dec 30, 2017 · 2 comments

Comments

@CodingItWrong
Copy link
Contributor

CodingItWrong commented Dec 30, 2017

Description

When following the Getting Started instructions in a new project created with the React Native CLI, after running detox test I get the error:

Error: Cannot find module 'babel-polyfill'
...
    at Object.<anonymous> (/path/to/app/e2e/init.js:1:63)
...
  • Detox 6.0.4
  • React Native 0.51

Fixing this just required installing babel-polyfill: npm install babel-polyfill --save-dev. I think it would be helpful for new users to add this instruction to the Getting Started guide. If babel-polyfill was included by default in older versions of React Native, then maybe some nuance around "if you get this error, perform this extra step" or "if your app is running a version of React Native newer than 0.x, perform this extra step" etc.

Steps to Reproduce

  • react-native init DetoxTest
  • (follow steps in Getting Started)

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 6.0.4
  • Node: 8.9.3
  • Device: 11.2
  • Xcode: 9.2
  • macOS: 10.13.2

Device and verbose Detox logs

# detox test
node_modules/.bin/mocha e2e --opts e2e/mocha.opts
module.js:538
    throw err;
    ^

Error: Cannot find module 'babel-polyfill'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/path/to/app/e2e/init.js:1:63)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at /Users/josh/apps/temp/ReactNativeTest/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/josh/apps/temp/ReactNativeTest/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/Users/josh/apps/temp/ReactNativeTest/node_modules/mocha/lib/mocha.js:536:10)
    at Object.<anonymous> (/Users/josh/apps/temp/ReactNativeTest/node_modules/mocha/bin/_mocha:573:18)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
child_process.js:644
    throw err;
    ^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts
    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at runMocha (/Users/josh/apps/temp/ReactNativeTest/node_modules/detox/local-cli/detox-test.js:61:6)
    at Object.<anonymous> (/Users/josh/apps/temp/ReactNativeTest/node_modules/detox/local-cli/detox-test.js:39:5)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
@rotemmiz
Copy link
Member

rotemmiz commented Jan 8, 2018

Just remove require('babel-polyfill'); from your generated code

@rotemmiz
Copy link
Member

rotemmiz commented Jan 8, 2018

  • fixed it in the template

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants