okwasniewski / react-native-monorepo

12 stars 3 forks source link

Error: Unable to resolve module react-native from... #9

Open addytheyoung opened 1 year ago

addytheyoung commented 1 year ago

error: Error: Unable to resolve module react-native from /Users/me/projects/monorepo/apps/mobile/index.tsx: react-native could not be found within the project or in these directories: node_modules ../../node_modules ../../../../../node_modules 3 | */ 4 |

5 | import { AppRegistry } from "react-native"; | ^ 6 | import App from "./src/pages/App"; 7 | import { name as appName } from "./app.json"; 8 |

Happens when running 'npx react-native run-ios' from mobile. What could be happening here? yarn install worked fine, and no issues when installing the podfiles. Same issue when following blog instructions from scratch, and from cloning. Is it some M1 architecture issue?

minapham17 commented 1 year ago

@addytheyoung Add this to metro.config.js: watchFolders: [ path.resolve(dirname, '../../'), path.resolve(dirname, '../../node_modules'), path.resolve(__dirname, '../../node_modules/@example-app/shared'), ],