Hva*_*res 6 javascript dependencies reactjs react-native expo
#node_modules/expo/AppEntry.js:[BABEL]
我已经为我的项目安装了所有依赖项,但我遇到了这个问题,但我不知道如何解决它。
#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": {
    "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"
}
检查了您的 GitHub 存储库,正如 所指出的byCedric,您的问题出在您正在使用的依赖项上。我进行了以下更改,该应用程序似乎正在运行,
截屏:
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
}
安装上述所有依赖项后,我还遇到了以下文件的两个问题:
node_modules\dotenv\lib\main.jsnode_modules\react-native-dotenv\index.js他们正在使用Node standard library module "fs" ,所以我将react-native-fs上面两个文件中的它替换为 package 。
修改后两个文件:
//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}`)
}
...
{
  "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
}
中也有一个拼写错误WeatherDetails.js,您通过unitSystem而不是unitsSystem作为props