Unable to resolve “../../App” from “node_modules/expo/AppEntry.js”

倖福魔咒の 提交于 2021-02-10 14:35:28

问题


I am making a vue-native app with expo. when upgrading to expo version 33 I get the following error "Unable to resolve "../../App" from "node_modules/expo/AppEntry.js". The need to upgrade to version 33 is because I need the expo filesystem module.

I have already made a new project from scratch and the same error still occurs.

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": {
    "expo": "^33.0.0",
    "global": "^4.4.0",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
    "react-native-cli": "^2.0.1",
    "react-native-web": "^0.11.4",
    "vue-native-core": "0.0.8",
    "vue-native-helper": "0.0.11"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0-0",
    "babel-preset-expo": "^5.1.1",
    "vue-native-scripts": "0.0.16"
  },
  "private": true
}

回答1:


I solve the problem as downgrading Expo Sdk 33 to 32.

To downgrade expo sdk;

1- open app.json, change sdkVersion to "32.0.0" 2- open package.json, change the following dependencies

  {
  "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
  "expo": "^32.0.0",
  "react": "16.5.0"
   }

3- delete node_modules, install again via "npm install" command




回答2:


I ran into this problem too. I used the expo cli to make the project which sets up your app.json file with "entryPoint": "node_modules/expo/AppEntry.js". AppEntry.js tries to default import from a js file called App in the root directory. Make sure you have a file called App.js|.tsx that default exports a react component.




回答3:


In app.json add

"sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"]

Inside

"packagerOpts"

Image here




回答4:


In app.json add

"sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"]

link: https://github.com/GeekyAnts/vue-native-core/issues/183#issuecomment-519518412




回答5:


Make sure you have a "App.js" file in your apps folder, and make sure its not in any folder so the file path should be "/Users/USER/PROJECTNAME/App.js"



来源:https://stackoverflow.com/questions/57198283/unable-to-resolve-app-from-node-modules-expo-appentry-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!