cli
cli copied to clipboard
Unable to start server in new window when using yarn with pnpm linker
Environment
yarn v4 (berry)
with nodeLinker: pnpm
Description
Running run-ios
or run-android
without dev server running results in:
error Node module directory for package .bin was not found.
This is caused by packages/cli-tools/src/startServerInNewWindow.ts
relying on .bin
directory which is not present when using yarn
with nodeLinker: pnpm
.
Reproducible Demo
https://github.com/jbroma/repro-rn-cli-start-server
Steps:
- run
yarn
- run
yarn run-ios
oryarn run-android
Additional notes
Repro contains local fix equivalent to this fix, which will be released in 0.74
.
hey @jbroma! thanks for raising issue, I can confirm that issue exist. I'm wondering what other temporary directory we can pick , because we're saving .packager.env
under node_modules/.bin
to make sure that every project has proper information assigned, so e.g. this kind of setups could work:
package.json
node_modules
react-native/
packages/
app-a
node_modules
.bin
app-b
node_modules
.bin
So by assuming every project has their specific .bin
directory relevant app will use right information saved inside .packager.env
file. We can't save them for example under require.resolve('react-native')
, because probably in most monorepos setups apps across monorepo will use the same react-native
package, and potentially pick wrong informations and it will cause very hard problems to debug.
cc: @tido64 do you have maybe any ideas where we could potential save it?
In RNTA, we always create node_modules/.generated
relative to the project root. I think Babel does something similar for .cache
. We could do something like that here? The alternative is to use the project folder itself, but that's another .gitignore
entry that you have to maintain.