Skip to content

Getting Started also requires adding babel-polyfill #481

@CodingItWrong

Description

@CodingItWrong

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions