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

react native in workspace #2365

Closed
hemedani opened this issue Feb 18, 2020 · 10 comments
Closed

react native in workspace #2365

hemedani opened this issue Feb 18, 2020 · 10 comments

Comments

@hemedani
Copy link

pnpm version:

➜ pnpm --version
4.9.3

Code to reproduce the issue:

pnpx react-native run-ios

Expected behavior:

run react native project

Actual behavior:

error for finding metro modules :

warn Package react-native has been ignored because it contains invalid configuration. Reason: Cannot find module 'lodash'
Require stack:
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/@react-native-community/cli-platform-ios/3.2.0/node_modules/@react-native-community/cli-platform-ios/build/config/index.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/@react-native-community/cli-platform-ios/3.2.0/node_modules/@react-native-community/cli-platform-ios/build/index.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/react-native/0.61.5_react-native@0.61.5+react@16.9.0/node_modules/react-native/react-native.config.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/import-fresh/2.0.0/node_modules/import-fresh/index.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/cosmiconfig/5.2.1/node_modules/cosmiconfig/dist/loaders.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/cosmiconfig/5.2.1/node_modules/cosmiconfig/dist/createExplorer.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/cosmiconfig/5.2.1/node_modules/cosmiconfig/dist/index.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/@react-native-community/cli/3.2.0_react-native@0.61.5/node_modules/@react-native-community/cli/build/tools/config/readConfigFromDisk.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/@react-native-community/cli/3.2.0_react-native@0.61.5/node_modules/@react-native-community/cli/build/tools/config/index.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/@react-native-community/cli/3.2.0_react-native@0.61.5/node_modules/@react-native-community/cli/build/commands/install/install.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/@react-native-community/cli/3.2.0_react-native@0.61.5/node_modules/@react-native-community/cli/build/commands/index.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/@react-native-community/cli/3.2.0_react-native@0.61.5/node_modules/@react-native-community/cli/build/index.js
- /Users/syd/work/sitak/satekPnpm/node_modules/.pnpm/registry.npmjs.org/react-native/0.61.5_react-native@0.61.5+react@16.9.0/node_modules/react-native/cli.js
error Unrecognized command "run-ios".
info Run "react-native --help" to see a list of all available commands.

Additional information:

this repo it's an example of that error

  • node -v prints:
➜ node -v
v13.8.0
  • Windows, OS X, or Linux?: OS X
@zkochan
Copy link
Member

zkochan commented Feb 19, 2020

React Native currently doesn't work with pnpm because it has issues with symlinks. As far as I know, @jkolyer is investigating it.

The problem with react-native is actually due to cocoapods. Apparently the symbolic links are not supported well and the XCode setup is broken. Looking at a workaround.

I fixed the cocoapods issue with a fork of somebody else's fork. But metro does not play well with pnpm so that's the next rabbit hole.

@hemedani
Copy link
Author

we can run react native with some dirty tricks but it's has a lot's of problems ...
any way thank's for awesome project.

@zkochan
Copy link
Member

zkochan commented Feb 20, 2020

Could you share those dirty tricks? We could document them in our docs

@davidcallanan
Copy link

I'll forever miss pnpm when working with react native 😢

@adelarsq
Copy link

adelarsq commented Sep 3, 2020

@zkochan Can this issue be reopened as unsolved?

@zkochan
Copy link
Member

zkochan commented Sep 3, 2020

On our side, there is nothing we can currently do to make React Native work with pnpm. React Native doesn't work with a node_modules that contains symlinks. pnpm cannot create a node_modules w/o symlinks. So this should be solved on the React Native side.

@adelarsq
Copy link

adelarsq commented Sep 4, 2020

@zkochan Thanks for the quick feedback.

@ShivamJoker
Copy link

I also tried it and it didn't work :( still

@zkochan
Copy link
Member

zkochan commented Dec 3, 2020

@vjpr said he used React native with no issues. Related issue: #1252

@vjpr vjpr mentioned this issue Dec 7, 2020
amcsi added a commit to amcsi/ch-calculator that referenced this issue Apr 26, 2023
PNPM (symlinks) don't work on react-native :(
pnpm/pnpm#2365
@karlhorky
Copy link

karlhorky commented Jan 27, 2024

More users talking about using pnpm with React Native and workspaces (if I understand correctly, following pnpm symlinks is supported in workspaces, without workarounds like node-linker=hoisted 🙌):

If you're using Expo, you're still going to have problems with pnpm directory structure (even if you use a setup that works for RN / Metro):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants