facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.18k stars 24.32k forks source link

New inited app not working with pnpm installion #39167

Closed linonetwo closed 1 year ago

linonetwo commented 1 year ago

Description

Error

None of these files exist:
  * node_modules/expo/AppEntry

while node_modules/expo/AppEntry.js turely exists.

I think this is because it can't follow pnpm's soft link. I try using npm install and it works.

Full error:

pnpm run android

> tidgi-mobile@1.0.0 android /Users/linonetwo/Desktop/repo/TidGi-Mobile
> expo start --android

Starting project at /Users/linonetwo/Desktop/repo/TidGi-Mobile
Starting Metro Bundler
warning: Watchman `watch-project` returned a warning: Recrawled this watch 3 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/linonetwo/Desktop/repo/TidGi-Mobile' ; watchman watch-project '/Users/linonetwo/Desktop/repo/TidGi-Mobile'`

warning: Watchman `query` returned a warning: Recrawled this watch 3 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/linonetwo/Desktop/repo/TidGi-Mobile' ; watchman watch-project '/Users/linonetwo/Desktop/repo/TidGi-Mobile'`

Recrawled this watch 3 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/linonetwo/Desktop/repo/TidGi-Mobile' ; watchman watch-project '/Users/linonetwo/Desktop/repo/TidGi-Mobile'`

› Opening exp://192.168.3.15:8081 on SHARK_KTUS_A0
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▄▀▀▄▄ ██ █ ▄▄▄▄▄ █
█ █   █ ███▄█   ▄▄█ █   █ █
█ █▄▄▄█ ██▄▀▄▀ ██▀█ █▄▄▄█ █
█▄▄▄▄▄▄▄█ █ ▀▄▀ ▀ █▄▄▄▄▄▄▄█
█▄▄▀ ▄▀▄██ ▄▄▀▀█▀ █▄█▀█▀▀▄█
█   █ ▀▄█ ▀  ▀█▄  ▀███▄▀▀ █
█▀▀█ ▄▄▄▄▀▄█▄▄▀▄ █ ▄▀▀█▀ ██
█ ▄▀█▀▀▄ ██▄ ▄▄▀ ▄▀ ██▄▀  █
█▄█▄▄██▄▄ ▄▀▀▀  █ ▄▄▄  ▄▀▄█
█ ▄▄▄▄▄ ██▀▄▄▀  █ █▄█ ██▀▄█
█ █   █ █ ▀ █▄██▄ ▄  ▄ █  █
█ █▄▄▄█ █▀▄ █▄█  ▄█▀▀▄█   █
█▄▄▄▄▄▄▄█▄███▄▄▄▄▄▄█▄▄███▄█

› Metro waiting on exp://192.168.3.15:8081
› 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.
Error: Unable to resolve module ./node_modules/expo/AppEntry from /Users/linonetwo/Desktop/repo/TidGi-Mobile/.:

None of these files exist:
  * node_modules/expo/AppEntry(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
  * node_modules/expo/AppEntry/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
    at ModuleResolver.resolveDependency (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:114:15)
    at DependencyGraph.resolveDependency (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
    at /Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/lib/transformHelpers.js:169:21
    at Server._resolveRelativePath (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:1045:12)
    at async Server.requestProcessor [as _processBundleRequest] (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:449:37)
    at async Server._processRequest (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:383:7)
Error: Unable to resolve module ./node_modules/expo/AppEntry from /Users/linonetwo/Desktop/repo/TidGi-Mobile/.:

None of these files exist:
  * node_modules/expo/AppEntry(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
  * node_modules/expo/AppEntry/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
    at ModuleResolver.resolveDependency (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:114:15)
    at DependencyGraph.resolveDependency (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
    at /Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/lib/transformHelpers.js:169:21
    at Server._resolveRelativePath (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:1045:12)
    at async Server.requestProcessor [as _processBundleRequest] (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:449:37)
    at async Server._processRequest (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:383:7)
Error: Unable to resolve module ./node_modules/expo/AppEntry from /Users/linonetwo/Desktop/repo/TidGi-Mobile/.:

None of these files exist:
  * node_modules/expo/AppEntry(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
  * node_modules/expo/AppEntry/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
    at ModuleResolver.resolveDependency (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:114:15)
    at DependencyGraph.resolveDependency (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
    at /Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/lib/transformHelpers.js:169:21
    at Server._resolveRelativePath (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:1045:12)
    at async Server.requestProcessor [as _processBundleRequest] (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:449:37)
    at async Server._processRequest (/Users/linonetwo/Desktop/repo/TidGi-Mobile/node_modules/.pnpm/metro@0.76.7/node_modules/metro/src/Server.js:383:7)
› Stopped server

React Native Version

0.72.4

Output of npx react-native info

info Fetching system and libraries information... System: OS: macOS 13.5 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 54.77 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.2.0 path: ~/.nvm/versions/node/v20.2.0/bin/node Yarn: version: 1.22.4 path: /usr/local/bin/yarn npm: version: 9.6.6 path: ~/.nvm/versions/node/v20.2.0/bin/npm Watchman: version: 2023.08.14.00 path: /usr/local/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /Users/linonetwo/.gem/ruby/2.6.0/bin/pod SDKs: iOS SDK: Platforms:

Steps to reproduce

pnpm dlx create-expo-app -t expo-template-blank-typescript TidGi-Mobile

And using pnpm run android

Snack, screenshot, or link to a repository

Just use an official blank setup is enough.

github-actions[bot] commented 1 year ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
cortinico commented 1 year ago

This is a known issue, @byCedric @robhogan and others are currently working on pnpm support. If you search for pnpm on other repos you'll find related issues to this problem as well (such as https://github.com/react-native-community/cli/issues/1207).

I'll close this one as we're aware of the issue and currently working on it, we won't be using this specific bug report to track this effort.

linonetwo commented 1 year ago

Okay, and I already get it work somehow, by following those discussion threads, thanks.

By adding this npmrc https://github.com/tiddly-gittly/TidGi-Mobile/blob/master/.npmrc

just an workaround before the official fix.