RocketChat / Rocket.Chat.ReactNative

Rocket.Chat mobile clients
https://rocket.chat
MIT License
2.03k stars 1.18k forks source link

Problem with setting up the project image picker issue #5761

Open X1Vi opened 5 months ago

X1Vi commented 5 months ago

I just ran these two command

yarn install yarn android

and this error occurred something related to the image picker `needJobCoder@DESKTOP-G3MCU14 MINGW64 /c/openSource/rocker-react-native/Rocket.Chat.ReactNative/Rocket.Chat.ReactNative (develop) $ yarn react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res yarn run v1.22.21 $ C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules.bin\react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res warn Package react-native-math-view contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "npx react-native config" command and contact the package maintainers about this. Welcome to Metro v0.80.6 Fast - Scalable - Integrated

error Unable to resolve module @react-native-community/picker from C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\react-native-ui-lib\lib\components\WheelPicker\index.js: @react-native-community/picker could not be found within the project or in these directories: node_modules\react-native-ui-lib\node_modules node_modules 3 | import React, {Component} from 'react'; 4 | import {DeviceEventEmitter, requireNativeComponent, StyleSheet, View} from 'react-native';

5 | import {Picker} from '@react-native-community/picker'; | ^ 6 | import WheelPickerItem from './WheelPickerItem'; 7 | import {Constants} from '../../../src/helpers'; 8 | import {Typography, Colors} from '../../../src/style';. Error: Unable to resolve module @react-native-community/picker from C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\react-native-ui-lib\lib\components\WheelPicker\index.js: @react-native-community/picker could not be found within the project or in these directories: node_modules\react-native-ui-lib\node_modules node_modules 3 | import React, {Component} from 'react'; 4 | import {DeviceEventEmitter, requireNativeComponent, StyleSheet, View} from 'react-native'; 5 | import {Picker} from '@react-native-community/picker'; | ^ 6 | import WheelPickerItem from './WheelPickerItem'; 7 | import {Constants} from '../../../src/helpers'; 8 | import {Typography, Colors} from '../../../src/style'; at ModuleResolver.resolveDependency (C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:138:15) at DependencyGraph.resolveDependency (C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\metro\src\node-haste\DependencyGraph.js:231:43) at C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\metro\src\lib\transformHelpers.js:156:21 at resolveDependencies (C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\metro\src\DeltaBundler\buildSubgraph.js:42:25) at visit (C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\metro\src\DeltaBundler\buildSubgraph.js:83:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 2) at async visit (C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\metro\src\DeltaBundler\buildSubgraph.js:92:5) at async Promise.all (index 3) at async visit (C:\openSource\rocker-react-native\Rocket.Chat.ReactNative\Rocket.Chat.ReactNative\node_modules\metro\src\DeltaBundler\buildSubgraph.js:92:5) info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. `

diegolmello commented 5 months ago

Maybe patch-package was not applied correctly? https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/8b25a168247da333794d1a361059499cd9f1244b/patches/react-native-ui-lib%2B7.2.1.patch#L10 It's triggered on postinstall, but it seems it wasn't triggered correctly on your environment. Try to understand why it wasn't applied or apply everything from patches folder manually.

X1Vi commented 5 months ago

Maybe patch-package was not applied correctly? https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/8b25a168247da333794d1a361059499cd9f1244b/patches/react-native-ui-lib%2B7.2.1.patch#L10 It's triggered on postinstall, but it seems it wasn't triggered correctly on your environment. Try to understand why it wasn't applied or apply everything from patches folder manually.

Post install and what file in specific in patch ?

X1Vi commented 5 months ago

https://paste.myst.rs/skuw5ded here is 7.2.1 file

X1Vi commented 5 months ago

I think there was a change in the library name or something

Lao-Ax commented 2 months ago

Actually I faced with similar problem. I use yarn 4+ and a lot of patches just not applied. Even dericlty by git. There is a lot differences in resulting node-modules files. Like " or ', spaces. Some times lines of code differ completely.

I didin't realise that something like this could even happen.

An example: master (v4.51) patch for node_modules/react-native-ui-lib/src/components/connectionStatusBar/index

  1. my node-modules doesn't have ts file. Only js.
  2. in the pathc there is a line import {ConnectionStatusBarProps, ConnectionStatusBarState, DEFAULT_PROPS} from './Types'; Note: there are 3 modules. But in the node-modules I have import { ConnectionStatusBarProps, DEFAULT_PROPS } from "./Types"; - just 2.

I'm a bit confused :) If someone faced the same and got a solution - I'll be appreciate.

Lao-Ax commented 1 month ago

For those who will be after me.

Error Package react-native-math-view contains invalid configuration: "dependency.assets" was solved by this post https://github.com/wix/react-native-navigation/issues/7647

It means you have to write a patch to delete assets from the react-native-math-view lib.

Regarding differences yarn4 and yarn1. I noticed that yarn 1 downloads code via codeload using tar.gz, when yarn4 uses just hash commit. I solved this issue by adding to the package.json to the resolutions section a copy of a line from yarn1 lock file for a moot lib.