-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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 isn't compatible with yarn pnp #22163
Comments
Can you run If you believe this information is irrelevant to the reported issue, you may write |
That path is hard coded in the project.pbxproj file of the iOS app. That's just one spot though, the native app projects resolve the native module dependencies using file paths pointing to node_modules. They are unable to run a JS based resolver to find those dependencies in the current conventions of React Native. This looks like a tough nut to crack, considering the PNP proposal only seems to talk about node.js and modifying the require hook. Any modifications to RN that only accounts for PNP would mean that npm won't work with React Native anymore. Maybe you can open a discussion for this in the discussions repo? I doubt this will be resolved quickly as an issue. |
Metro, one part of what needs to be updated for PnP, will have its PnP resolver open sourced: facebook/metro#308 I am working on a patch for the CLI to give it the ability to see I am not sure about how to solve the hard-coded paths to The Gradle and BUCK build scripts will need to be updated too. |
What if RN offered a prebuilt binary containing all the node_module requirements for a certain revision? |
Ideally there should be a way to do this without needing to do something like that. |
@empyrical What if we use the install script or a new 'rnpm' like script to resolve the paths from JS using the |
The Gradle and BUCK scripts should, hypothetically, be able to have some kind of helper functions written for them that could call a node subprocess, like:
Which would print What I don't know is if something could be done like this with XCode paths. My knowledge of XCode is weak, but could you provide a path in some way like you can in bash, like:
? |
I am tackling this issue first over at the repo for I think the bulk of the work for this is in the CLI half of React Native |
I am closing this issue because it does not contain the necessary environment info, and there has been no followup in a while. If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here. |
Environment
[skip envinfo]
react-native info
doesn't work in this scenario:Command ``info`` unrecognized. Make sure that you have run ``npm install`` and that you are inside a react-native project.
Description
If you enable yarn pnp for a React Native app, it doesn't work. Perhaps something is hardcoded to look in
./node_modules
?The resulting error is:
Error: Couldn't find a suitable Node resolution for unqualified path "<path-to-your-rn-project>/node_modules/react-native/local-cli/cli.js"
Reproducible Demo
react-native init someproject
cd someproject
yarn --enable-pnp
yarn start
The text was updated successfully, but these errors were encountered: