#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"
}
最佳答案
正如 byCedric
指出的那样,检查了您的 GitHub 存储库,您的问题出在您使用的依赖项上。我进行了以下更改,该应用似乎可以正常运行,
截图:
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.js
node_modules\react-native-dotenv\index.js
他们使用的是 Node 标准库模块“fs”
,所以我在上述两个文件中都将其替换为 react-native-fs
包。
修改后的两个文件:
//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
...
WeatherDetails.js
中也有错别字,您传递了 unitSystem
而不是 unitsSystem
作为 props
关于javascript - 我该如何解决这个问题 : "node_modules/expo/AppEntry.js: [BABEL]"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64747106/