expo-cli icon indicating copy to clipboard operation
expo-cli copied to clipboard

@expo/package-manager: resolving to pnpm despite project being excluded from pnpm workspace

Open louix opened this issue 2 years ago • 1 comments

Summary

You can include/exclude directories from a pnpm workspace within the packages section of the top level pnpm-workspace.yaml file. This means you can have code/projects included in your monorepo that is not managed using pnpm.

Unfortunately when running eas build --local inside an excluded directory, it now tries to use pnpm for the INSTALL_DEPENDENCIES step.

The problem is in this function: https://github.com/expo/expo-cli/blob/5d271a29ad943a951c06e6734ff29b17e1ebbf24/packages/package-manager/src/utils/nodeWorkspaces.ts#L19

It finds the top level pnpm-workspace.yaml, but doesn't check if the directory of the expo project is actually included.

Ironically I think this came from the pnpm support commit: https://github.com/expo/expo-cli/commit/41d4e1be6914a286ddad42890225b4ba473622bc

Environment

  expo-env-info 1.0.3 environment info:
    System:
      OS: Linux 5.18 Arch Linux
      Shell: 5.1.16 - /bin/bash
    Binaries:
      Node: 14.19.1 - /nix/store/dkarbgfm9nwadqk2nycrg6g4gnzirk2f-nodejs-14.19.1/bin/node
      Yarn: 1.22.18 - ~/dev/project/node_modules/.bin/yarn
      npm: 6.14.16 - /nix/store/dkarbgfm9nwadqk2nycrg6g4gnzirk2f-nodejs-14.19.1/bin/npm
    IDEs:
      Android Studio: AI-212.5712.43.2112.8609683
    npmPackages:
      expo: 44.0.5 => 44.0.5 
      react: 17.0.1 => 17.0.1 
      react-dom: 17.0.1 => 17.0.1 
      react-native: 0.64.3 => 0.64.3 
      react-native-web: 0.17.1 => 0.17.1 
    npmGlobalPackages:
      expo-cli: 5.0.3
    Expo Workflow: managed

Please specify your device/emulator/simulator platform, model and version

N/A

Error output

No response

Reproducible demo or steps to reproduce from a blank project

  1. Make an empty pnpm workspace
  2. Add an empty expo project using yarn as the package manager
  3. Exclude the expo project from the pnpm workspace by modifying the packages section of the top level pnpm-workspace.yaml file
  4. Run eas build --local

It will try to use pnpm instead of the expected yarn to install dependencies.

louix avatar Jun 13 '22 13:06 louix

Running into the same issue. Nextjs uses a different version of React. So can't have both in the same monorepo using pnpm and need to be able to exclude expo project from pnpm. Thank you.

nnennajohn avatar Jun 20 '22 10:06 nnennajohn

Closing as this will be fixed in the next version of Expo CLI

EvanBacon avatar Oct 27 '22 21:10 EvanBacon