How do I fix this issue: "node_modules/expo/AppEntry.js: [BABEL]"?

Viewed 3975

#node_modules/expo/AppEntry.js: [BABEL]

I already installed all the dependencies for my project, and I'm getting this issue, and I'm not sure how to solve it.

#package.json - Main

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "babel": "^6.23.0",
    "expo": "~39.0.2",
    "expo-status-bar": "~1.0.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz",
    "react-native-dotenv": "^2.4.2",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "babel-plugin-module-resolver": "^4.0.0"
  },
  "private": true,
  "name": "my-project"
}

enter image description here

1 Answers

Checked your GitHub repo, as pointed out by byCedric, your Problem was with dependencies that you were using. I made the following changes and the app appears to be working,

Screenshot:

enter image description here

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-community/picker": "^1.6.6",
    "expo": "~39.0.2",
    "expo-status-bar": "~1.0.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz",
    "react-native-dotenv": "^2.4.2",
    "react-native-fs": "^2.16.6",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0"
  },
  "private": true
}

after installing all the dependencies mentioned above, I faced two more issues with the following files:

  1. node_modules\dotenv\lib\main.js
  2. node_modules\react-native-dotenv\index.js

They were using Node standard library module "fs" , so I replaced it with react-native-fs package in both the above files.

both files after modifying:

//node_modules\dotenv\lib\main.js

const fs = require("react-native-fs")
const path = require('path')

function log (message /*: string */) {
  console.log(`[dotenv][DEBUG] ${message}`)
}
...

// node_modules\react-native-dotenv\index.js
const {readFileSync} = require("react-native-fs")
const dotenv = require('dotenv')

function parseDotenvFile(path, verbose = false) {
  let content
...

also there was a typo in the WeatherDetails.js, you passed unitSystem instead of unitsSystem as a props

Related