Search code examples
react-nativedetox

Couldn't find preset "module:react-native-dotenv"


I setup a test with Detox, but when I launch it with detox test, the test starts but I receive this error:

Couldn't find preset "module:react-native-dotenv" relative to directory "/Users/iota/workspace/Project"

In the scene file I am trying to test I have this: import { BASE_URL, GOOGLE_APP_ID } from 'react-native-dotenv';

My .babelrc file:

{
  "presets": [
    "module:react-native-dotenv",
    "module:metro-react-native-babel-preset"
  ]
}

Any hint?

UPDATE

If I remove the line module:react-native-dotenv, I have a similar error for the module:metro-react-native-babel-preset


Solution

  • You need to install the presets using npm, so a

    npm install --save-dev metro-react-native-babel-preset react-native-dotenv
    

    should solve the issue.