简体   繁体   中英

Expo: Cannot resolve entry file: The `main` field defined in your `package.json` points to a non-existent path

I am working with the default typescript template generated from the command line npx create-expo-app -t expo-template-blank-typescript and I get this error when I try to start the project.

The main reason I think, is because I am working in a monorepo.

The entry point in package.json points to "main": "node_modules/expo/AppEntry.js" but in a monorepo, the expo module is only present in the parent node_modules folder.

What I have tried

I have tried setting up the entry point in app.json to: ./src/App.tsx , ./dist/App.js with no success

When I change the main field of package.json to ../../node_modules/expo/AppEntry.ts I got this error:

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11)

My setup

I am working with turborepo. My folder structure look like

├── app
│   ├──project1
│   │  ├── package.json
│   │  ├── App.tsx
│   │  ├── app.json
│   │  └── tsconfig.json
│   └──node_modules
└── node_modules
    └── expo
        └── AppEntry.js

Is there a clean way to handle this scenario?

I finally found the answer here:

https://docs.expo.dev/guides/monorepos/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM