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

Pnpm not working with Expo #22413

Open
MariuzM opened this issue May 8, 2023 · 9 comments
Open

Pnpm not working with Expo #22413

MariuzM opened this issue May 8, 2023 · 9 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@MariuzM
Copy link
Contributor

MariuzM commented May 8, 2023

Minimal reproducible example

https://github.com/MariuzM/expo-test

Summary

When i run pnpm ios i get his error. The Expo install is latest with typescript. No other tweaks / changes have been done.

image

Environment

Local

@MariuzM MariuzM added the needs validation Issue needs to be validated label May 8, 2023
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 8, 2023
@LeDominik
Copy link

I'm also trying to get pnpm working -- what holds me back is that expo-modules (bootstrapped cleanly from the expo modules template) plain out refuses to use pnpm... otherwise I guess it would work following all the fixes in here: https://github.com/byCedric/expo-monorepo-example

From what I can observe around metro#1 we're very close to this actually all working nicely with just plain (space-efficient & fast) pnpm symlinks.

@LeDominik
Copy link

@MariuzM you'd at least need an .npmrc to get a flat node_module directory:

node-linker=hoisted

@MariuzM MariuzM closed this as completed May 13, 2023
@karlhorky
Copy link
Contributor

@MariuzM should this be reopened now that Expo SDK 50 is out, which uses React Native 0.73 internally?

React 0.73 has made symlink support stable. Would be great to get pnpm symlink support in Expo apps (without node-linker=hoisted or any other workarounds).

@MariuzM
Copy link
Contributor Author

MariuzM commented Jan 27, 2024

Hey, hm not sure i've stoped using PNPM and moved to Bun

@karlhorky
Copy link
Contributor

karlhorky commented Jan 27, 2024

Just tried Expo 50 + RN 0.73 with a new create-expo app just now (without using .npmrc with node-linker=hoisted), and it's still a problem:

$ mkdir a
$ cd a
$ pnpm create expo@latest --template expo-template-blank-typescript .

.../Library/pnpm/store/v3/tmp/dlx-68676  |   +1 +
.../Library/pnpm/store/v3/tmp/dlx-68676  | Progress: resolved 1, reused 0, downloaded 1, added 1, done
✔ Downloaded and extracted project files.
> pnpm install
 WARN  8 deprecated subdependencies found: @babel/plugin-proposal-async-generator-functions@7.20.7, @babel/plugin-proposal-class-properties@7.18.6, @babel/plugin-proposal-nullish-coalescing-operator@7.18.6, @babel/plugin-proposal-numeric-separator@7.18.6, @babel/plugin-proposal-object-rest-spread@7.20.7, @babel/plugin-proposal-optional-catch-binding@7.18.6, @babel/plugin-proposal-optional-chaining@7.21.0, @npmcli/move-file@1.1.2
Packages: +840
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 847, reused 833, downloaded 7, added 840, done

dependencies:
+ expo 50.0.4
+ expo-status-bar 1.11.1
+ react 18.2.0
+ react-native 0.73.2

devDependencies:
+ @babel/core 7.23.9
+ @types/react 18.2.48
+ typescript 5.3.3

Done in 17.7s

✅ Your project is ready!

To run your project, run one of the following pnpm commands.

- pnpm run android
- pnpm run ios
- pnpm run web

The app scaffolded without problems, but as soon as I tried to run it on an Android emulator, it crashed, unable to resolve ../../App:

pnpm run android

> a@1.0.0 android /Users/k/p/a
> expo start --android

Starting project at /Users/k/p/a
Starting Metro Bundler
› Opening ... on Pixel_3a_API_30
✔ Expo Go on Pixel_3a_API_30 is outdated, would you like to upgrade? … yes
Uninstalling Expo Go from android device Pixel_3a_API_30.
Downloading the Expo Go app [================================================================] 100% 0.0s

...QR Code...

› Metro waiting on ...
› Scan the QR code above with Expo Go (Android) or the Camera app (iOS)

› Using Expo Go
› Press s │ switch to development build

› Press a │ open Android
› Press i │ open iOS simulator
› Press w │ open web

› Press j │ open debugger
› Press r │ reload app
› Press m │ toggle menu
› Press o │ open project code in your editor

› Press ? │ show all commands

Logs for your project will appear below. Press Ctrl+C to exit.
Android Bundling failed 710ms (node_modules/.pnpm/expo@50.0.4_@babel+core@7.23.9_@react-native+babel-preset@0.73.20/node_modules/expo/AppEntry.js)
Unable to resolve "../../App" from "node_modules/.pnpm/expo@50.0.4_@babel+core@7.23.9_@react-native+babel-preset@0.73.20/node_modules/expo/AppEntry.js"

It seems to be because of some hardcoded relative path in expo/AppEntry.js (which is deeper in the node_modules directory structure, because of how pnpm organizes modules.

@karlhorky
Copy link
Contributor

Also asked Expo and pnpm maintainers over here in the open pnpm issue about whether it would be possible to get symlinks support out of the box:

Copy link
Contributor

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

@github-actions github-actions bot added the stale label Apr 26, 2024
@karlhorky
Copy link
Contributor

Not stale

@github-actions github-actions bot removed the stale label Apr 26, 2024
@devlopersabbir
Copy link

with bun it works perfectly 🥲

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

5 participants