Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve "../../App" from "node_modules\expo\AppEntry.js" #183

Closed
zyxel648 opened this issue Aug 5, 2019 · 46 comments
Closed

Unable to resolve "../../App" from "node_modules\expo\AppEntry.js" #183

zyxel648 opened this issue Aug 5, 2019 · 46 comments

Comments

@zyxel648
Copy link

zyxel648 commented Aug 5, 2019

In console, I just run the following command:
vue-native init <project name>
And then, delete App.js file (App.vue file still exists)

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": "^34.0.1",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
    "react-native-web": "^0.11.4",
    "vue-native-core": "^0.1.0",
    "vue-native-helper": "^0.1.0",
    "vue-native-scripts": "0.0.16"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "babel-preset-expo": "^6.0.0"
  },
  "private": true
}

Beacause I have problems with installation of vue-native-scripts v.0.1.0 (#182), I added them manually. [email protected] did not work correncly with RN v.0.59 (expo sdk 34)

In stack trace I see:

The module '../../App' could not be found from 'C:\\sample\\node_moudules\\expo\\AppEntry.js'. Indead, none of these files exist:
* 'C:\\sample\\App(.native||.android.expo.js|.native.expo.js|.expo.js|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.json|.native.expo.json|.expo.json|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx

But why it's don't try to resolve module with vue extension?

metro.config.js

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */

const { getDefaultConfig } = require("metro-config");

module.exports = (async () => {
  const {
    resolver: { sourceExts }
  } = await getDefaultConfig();
  return {
    transformer: {
      babelTransformerPath: require.resolve("./vueTransformerPlugin.js"),
      getTransformOptions: async () => ({
        transform: {
          experimentalImportSupport: false,
          inlineRequires: false,
        },
      })
    },
    resolver: {
      sourceExts: [...sourceExts, "vue"]
    }
  };
})();

I spent about 3 days trying to solve this issue, but nothing found how to do this.

Repository

@Shrekie
Copy link

Shrekie commented Aug 6, 2019

Same.

With yarn I don't have the vue-native-scripts installation issue.

But I'm also getting Unable to resolve "../../App" from "node_modules/expo/AppEntry.js"
Failed building JavaScript bundle.

This is on a totally fresh cli init project

@ChildishForces
Copy link

Same here, I'm guessing it may have something to do with the new version of vue-native-cli that went live 4 days ago.

@zyxel648
Copy link
Author

zyxel648 commented Aug 6, 2019

Same here, I'm guessing it may have something to do with the new version of vue-native-cli that went live 4 days ago.

Actually no. I'm already have [email protected] and [email protected] and I'm trying to use previous versions (0.0.7 and 0.0.8) - get the same error. Also try to use expo sdk v. 33 - same error. It works only on expo sdk 32, but native-base don't. Maybe this error came from expo and metro bundler... who knows. I can't debug js code :(
Finally, I decide to not use vue-native and write with react, beacause vue-native has poor support unfortunately :( Error "Unable to resolve "../../App"" exists more than year and nobody wants to solve this issue 😢

@ChildishForces
Copy link

It's pretty bad that this package is basically unusable then. There's no way to init a new project.

@tjimenez
Copy link

tjimenez commented Aug 6, 2019

Same for me! :(

@drmmarsunited
Copy link

Also hitting this exact issue when trying to follow Getting Started instructions on the Vue native site

@AnkurDahama
Copy link

Same problem with me while following 'Getting started' on vue native site. Tried tweaking some versions but still no luck.

@koladev32
Copy link

import App from '../../App.vue' I tried this and it worked. You have to change the path in the AppEntry.js.

@AnkurDahama
Copy link

Still doesn't work. now getting Unable to resolve "../../App.vue" from "node_modules/expo/AppEntry.js"

@koladev32
Copy link

Okay I see. Send the tree view of your project.

@AnkurDahama
Copy link

Screenshot 2019-08-07 at 8 50 33

this is the root folder

@AnkurDahama
Copy link

Screenshot 2019-08-07 at 8 51 39

this is my AppEntry.js

@bthomas16
Copy link

This began happening to me when I was forced to upgrade Node.js to be compatable with a new Expo version. I had a working project, but after upgrading my Node.js version for Expo compatibility I began seeing this error.

I cleared my entire Node.js cache and got the latest of every dependency. I followed the Vue-native "getting started" documentation. And this error occurs when using command "npm run ios" after simply init-ing a new project

@ChildishForces
Copy link

Any update?

@zyxel648
Copy link
Author

zyxel648 commented Aug 8, 2019

Any update?

Same error. Even with latest version of expo-cli (3.0.9)

@ChildishForces
Copy link

This is a huge error. We can't even init a new project, so the package is essentially unusable at this version.

@damferreyra
Copy link

Hello there, I don't know if this gonna be helpful, but the latest functional configuration for me is:

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

app.json:
"sdkVersion": "32.0.0",

Reference SDK 32:
https://docs.expo.io/versions/latest/workflow/upgrading-expo-sdk-walkthrough/

With that configuration, I was able to compile a new app created with the latest vue-native CLI.
Sorry about my English :c, have a good day.

@Shrekie
Copy link

Shrekie commented Aug 8, 2019

I managed to get newest vue native to work.

In app.json add
"sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"]
Inside
"packagerOpts"

image

@ChildishForces
Copy link

I managed to get newest vue native to work.

In app.json add
"sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"]
Inside
"packagerOpts"

image

Hero. Worked for me.

@zyxel648
Copy link
Author

zyxel648 commented Aug 8, 2019

In app.json add
"sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"]
Inside
"packagerOpts"

As mentioned by @Shrekie. Thanks 👍

@zyxel648 zyxel648 closed this as completed Aug 8, 2019
@NovusTheory
Copy link

I probably would still keep this open as this doesn't fix vue-native itself

@zyxel648 zyxel648 reopened this Aug 8, 2019
@tjimenez
Copy link

tjimenez commented Aug 8, 2019

I've tried for some weeks and I can't even start the clean project.

The last try was adding "sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"] to app.json file and returns the following error. (clean install)

Resume

UnhandledPromiseRejectionWarning: Error: Cannot find module 'metro/src/reactNativeTransformer'

Cannot read property 'transformFile' of undefined
Failed building JavaScript bundle.

@tjimenez
Copy link

tjimenez commented Aug 8, 2019

I've tried for some weeks and I can't even start the clean project.

The last try was adding "sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"] to app.json file and returns the following error. (clean install)

Resume

UnhandledPromiseRejectionWarning: Error: Cannot find module 'metro/src/reactNativeTransformer'

Cannot read property 'transformFile' of undefined
Failed building JavaScript bundle.

UPDATE: Mixing the solution of @damferreyra and @zyxel648 made it work. Thanks guys.

@Syltis
Copy link

Syltis commented Aug 9, 2019

The current latest versions of react and vue worked for me when using the solution @zyxel648 proposed. Great stuff, been stuck on this for a while.

@Syltis
Copy link

Syltis commented Aug 9, 2019

I was wrong. This worked for running the app.vue file as project root, but if I add any kind of script to the component I get this error

App.vue: tsConsumer.originalPositionFor is not a function
Failed building JavaScript bundle.

No other error-messages are displayed. What does this even mean?

@damferreyra
Copy link

damferreyra commented Aug 9, 2019

@Syltis
I used to have the same error
, using "vue-native-scripts": "0.0.16" (instead of 0.1.0) resolved that issue in my case (with the @zyxel648 solution and the last expo sdk: 34 )

So far everything seems to work ok.

@anoop-ananthan
Copy link

We were not able to use this for our new project because I was not able to run the project

@ChildishForces
Copy link

ChildishForces commented Aug 9, 2019 via email

@Syltis
Copy link

Syltis commented Aug 9, 2019

@damferreyra
That actually worked. I am now able to script in App.vue after using the @zyxel648 solution and downgrading 'vue-native-scripts' to 0.0.16. Great stuff, thanks.

@RishabhKarnad
Copy link
Contributor

RishabhKarnad commented Aug 9, 2019

@zyxel648 @ChildishForces @Syltis I am unable to reproduce the issue on my end. Are you using the latest version of Expo client? I have tried clearing my cache, resetting the device data, and tested on both iOS and Android.

@Syltis the tsConsumer.originalPositionFor is not a function issue is known (#179). It will be fixed with v0.1.1 that should be out within a few hours.

@ChildishForces
Copy link

ChildishForces commented Aug 9, 2019 via email

@drmmarsunited
Copy link

drmmarsunited commented Aug 10, 2019

After manually adding "vue-native-scripts" pinned to my package.json file at version 0.0.16, I am up and running.

@RishabhKarnad
Copy link
Contributor

This is an Expo bug. The workaround mentioned by @Shrekie should work here. Expo seems to be ignoring some of the metro config resolver options.

The relevant Expo issues can be found here:

Until those issues are resolved, it seems Expo users will have to use the workaround and modify their app.json. I'll update the documentation to reflect this.

@RishabhKarnad
Copy link
Contributor

I managed to get newest vue native to work.

In app.json add
"sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"]
Inside
"packagerOpts"

image

Use this until the Expo bug is fixed.

@Wrufesh
Copy link

Wrufesh commented Aug 14, 2019

Simply adding sourceExts in packagerOpts doesnot solve the issue.
Its very frustating.
vue-native-cli (v-0.1.0)
expo-cli (v-3..0.9)

@Hiti3
Copy link

Hiti3 commented Jul 30, 2020

bump, still not resolved..

@RishabhKarnad
Copy link
Contributor

@Hiti3 can you please provide a project directory reproducing this with the latest versions of vue-native-core, vue-native-scripts and vue-native-helper (0.1.4)?

@PixsaOJ
Copy link

PixsaOJ commented Nov 6, 2020

Still a problem. Just installed expo-cli & vue-native-cli

@linsrep
Copy link

linsrep commented Dec 2, 2020

O que acontece no meu projeto é que eu alterei o arquivo APP, enviando ele para a pasta SRC/APP.... e o expo está buscando ../../APP... quando altero ../src/App no arquivo AppEntry.js localizado em 'node_modules\expo\AppEntrey.js" ele funciona. Como fazer o expo enxergar que eu mudei o arquivo APP?? Detalhe, eu estou usando index.tsx

@ThomasVeld
Copy link

Having the same problem!

@RishabhKarnad
Copy link
Contributor

To anyone still facing this issue, please add the following information:

  • Target platform (iOS / Android / web) -> Please note web is not supported at the moment (npm run web fails #268)
  • Development platform (OSX / Linux / Windows) and shell being used

@prashantpag26
Copy link

The error came because our App.js file is path was wrong or we by mistake change put App.js file in another folder.
Check below photo where I put my App.js in routes folder
image

@wixys
Copy link

wixys commented Apr 11, 2021

I nerver can't start a project with vue-native or expo, move to PWA.

@aacassandra
Copy link

2021, vue-native, fresh install can't start. move to ionic-vue3 with capacitor

@tuannq-0847
Copy link

Yeah, 2021 here. It is so fucking frustrating

@ijoolaie
Copy link

ijoolaie commented Jul 9, 2022

I managed to get newest vue native to work.

In app.json add "sourceExts": [ "js", "json", "ts", "tsx", "jsx", "vue"] Inside "packagerOpts"

image

I finally done that.
at first i added the above lines to app.json file but it didn't helped me. after that i wen to this file "../node_modules\expo\AppEntry.js" and edited the import App as "import App from "../../app" then saved it and it worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests