Unable to resolve module 'module://@babel/runtime/helpers/interopRequireDefault.js' on expo snack

Here I can see this error when I try to run my codes on expo snack
Unable to resolve module 'module://@babel/runtime/helpers/interopRequireDefault.js'

But my everything is working fine when I run the codes from my laptop and my application is working good on my physical android and ios device.

How can I check babel runtime on expo snack?

Or how should I solve this issue?

Thanks in advance

Hi @rubelamin

Snack sometimes has trouble with certain dependencies. Which dependency causes this error?

Hi, Thanks for your reply.

There is no specific dependency I can see there. below are all of my dependency

{
  "dependencies": {
    "mime": "*",
    "axios": "*",
    "redux": "4.0.0",
    "moment": "*",
    "jwt-decode": "*",
    "prop-types": "^15.5.0",
    "@rneui/base": "4.0.0-rc.6",
    "react-redux": "*",
    "redux-thunk": "*",
    "@types/react": "18.0.0",
    "@rneui/themed": "*",
    "expo-constants": "~13.2.4",
    "expo-status-bar": "~1.4.0",
    "@reduxjs/toolkit": "*",
    "@types/react-dom": "18.0.0",
    "expo-image-picker": "~13.3.1",
    "@expo/vector-icons": "^13.0.0",
    "react-native-paper": "4.9.2",
    "react-native-swiper": "*",
    "expo-linear-gradient": "~11.4.0",
    "react-native-screens": "~3.15.0",
    "react-native-tab-view": "^3.0.0",
    "@react-navigation/stack": "*",
    "react-native-pager-view": "5.4.24",
    "@react-navigation/native": "*",
    "@redux-devtools/extension": "*",
    "react-native-vector-icons": "9.2.0",
    "react-native-toast-message": "*",
    "@expo/vector-icons/Ionicons": "^13.0.0",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-swipe-list-view": "*",
    "@react-navigation/bottom-tabs": "*",
    "@react-navigation/native-stack": "*",
    "react-native-safe-area-context": "4.3.1",
    "react-native-dropdown-select-list": "*",
    "react-native-modal-datetime-picker": "*",
    "react-native-vector-icons/Ionicons": "*",
    "@react-navigation/material-top-tabs": "*",
    "react-native-vector-icons/FontAwesome": "*",
    "@react-native-community/datetimepicker": "6.2.0",
    "react-native-keyboard-aware-scroll-view": "*",
    "@react-native-async-storage/async-storage": "~1.17.3"
  }
}

Hi.

If I create a new Snack and add the following to it:

import mime from 'mime';

then I am prompted to add the dependency and Snack happily installs it.

If I then add the following:

import axios from 'axios';

I am prompted to add it, but I get the Unable to resolve module 'module://@babel/runtime/helpers/interopRequireDefault.js' error.

If I click on the error it opens the “PROBLEMS” log which shows the following:

App.js (1:7957)Unable to resolve module 'module://@babel/runtime/helpers/interopRequireDefault.js' (Device)

  Evaluating module://@babel/runtime/helpers/interopRequireDefault.js
  Evaluating module://axios.js
  Evaluating module://App.js.js
  Loading module://App.js

That also mentions Axios.

So the dependency that Snack is having a problem with is axios.

I suggest you see if anyone has reported the bug already, and if not, report it yourself.

Thanks for digging into this issue @wodin :pray:

Hey @rubelamin, as Michael mentioned, the error is caused by axios library. To use axios in an Expo Snack, just add the following specific version next to the library in "dependencies":

 "axios": "0.27.2",

You can see the working example on snack here: lonely blueberries - Snack without any errors.

Will have to investigate why the latest version of Axios library doesn’t work in Expo Snack (that is, versions 1.0.0 and above).

2 Likes

Thank you!

After added this version of axios the problem has gone away.

But let me know when the latest version of axios issues is solved

1 Like

Will do!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.