question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to start monorepo project following docs

See original GitHub issue

Summary

I’m setting up a new expo project and want to use a mono repo. I’ve done this before the unofficial way, but was excited to try the new official way. Steps I followed:

  1. Setup a new project with yarn 2.
  2. Made sure to switch from pnp -> node-modules
  3. added expo via the cli
  4. followed the instructions here: https://docs.expo.dev/guides/monorepos/

At this point I tried to start up the project and I get the following error:

Starting project at /Users/cwd/Developer/mono-test/native
Developer tools running on http://localhost:19002
Opening developer tools in the browser...
Starting Metro Bundler
Missing package "metro/src/lib/attachWebsocketServer" in the project at: /Users/cwd/Developer/mono-test/native
This usually means `react-native` is not installed. Please verify that dependencies in package.json include "react-native" and run `yarn` or `npm install`.
Error: Missing package "metro/src/lib/attachWebsocketServer" in the project at: /Users/cwd/Developer/mono-test/native
This usually means `react-native` is not installed. Please verify that dependencies in package.json include "react-native" and run `yarn` or `npm install`.
    at resolveFromProject (/Users/cwd/.config/yarn/global/node_modules/@expo/dev-server/src/metro/importMetroFromProject.ts:21:11)
    at importFromProject (/Users/cwd/.config/yarn/global/node_modules/@expo/dev-server/src/metro/importMetroFromProject.ts:27:18)
    at Object.importMetroLibAttachWebsocketServerFromProject (/Users/cwd/.config/yarn/global/node_modules/@expo/dev-server/src/metro/importMetroFromProject.ts:49:10)
    at Object.createDevServerAsync (/Users/cwd/.config/yarn/global/node_modules/@expo/dev-server/src/metro/createDevServerAsync.ts:63:33)
    at runMetroDevServerAsync (/Users/cwd/.config/yarn/global/node_modules/@expo/dev-server/src/MetroDevServer.ts:75:22)
    at startDevServerAsync (/Users/cwd/.config/yarn/global/node_modules/xdl/src/start/startDevServerAsync.ts:69:49)
    at startAsync (/Users/cwd/.config/yarn/global/node_modules/xdl/src/start/startAsync.ts:74:41)

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android, iOS, Web

SDK Version (managed workflow only)

45

Environment

expo-env-info 1.0.3 environment info:
    System:
      OS: macOS 12.3.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 16.13.0 - /usr/local/bin/node
      Yarn: 3.2.0 - /usr/local/bin/yarn
      npm: 8.1.0 - /usr/local/bin/npm
    Managers:
      CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    IDEs:
      Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
    npmGlobalPackages:
      expo-cli: 5.4.3
    Expo Workflow: managed

Reproducible demo

https://github.com/chrisdrackett/mono-test

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

19reactions
chrisdrackettcommented, May 12, 2022

I figured this out. I had an old version of expo-cli in an old version of yarn that I was unaware of. In previous projects we’ve just installed expo-cli within the project itself, but I was trying to do things the correct way this time and ended up using a very old version of expo-cli.

2reactions
M4nk1ncommented, May 26, 2022

Try installConfig.hoistingLimits at native/package.json.

"installConfig": {
  "hoistingLimits": "workspaces"
}

Or refer to my repo. https://github.com/M4nk1n/expo-yarn-monorepo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with monorepos - Expo Documentation
Learn about setting up Expo projects in a monorepo with Yarn v1 workspaces. Monorepos, or "monolithic repositories", are single repositories containing multiple ...
Read more >
A Guide to Monorepos for Front-end Code - Toptal
A monorepository is a code management and architectural concept whereby you keep all your isolated bits of code in one super repository instead...
Read more >
Things I wish I had known when I started JavaScript monorepo ...
The reason is simple: all packages of the monorepo will be recursively installed by running npm install from monorepo root. The recursive ...
Read more >
Setting up a Monorepo with React Native You.I and Yarn - G2i
In the location you want to create the project, run the following commands in your terminal line to create the folders, initialize git, ......
Read more >
Jest Projects in a Monorepo unable to find config files in projects
Okay, so after 4 days of intense digging through reported issues on github and a handful of youtube tutorials I could find, I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found