wuba/taro-playground

本地起playground在ios上挂

Opened this issue · 5 comments

我的环境:
xcode: v14.3.1
node: v16.20.0

repro step:

  • yarn -> yarn upgradePeerdeps -> yarn build:rn --platform ios -> yarn start -> yarn ios (npx react-native run-ios --no-packager --simulator 'iPhone 14 Pro')

yarn ios的时候报错和这个是这个issue里#91 一样的错: https://user-images.githubusercontent.com/42827938/253148187-c152ef13-4a4d-45ee-88ef-688839b7b2dc.png
然后我用xcode直接build,报错'value' is unavailable: introduced in iOS 12.0,按照这个帖子fix了facebook/react-native#34106 (comment)

然后继续yarn ios,成功,但是metro那边开始报错

 ERROR  Invariant Violation: Tried to register two views with the same name RNSVGRect
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
Error: Unable to resolve module ./Libraries/Components/DatePicker/DatePickerIOS from /Users/shinn/Documents/opensource/taro-playground/node_modules/react-native/index.js: 

None of these files exist:
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.scss|.scss|.native.sass|.sass|.native.less|.less|.native.css|.css|.native.pcss|.pcss|.native.json|.json|.native.styl|.styl|.native.cjs|.cjs|.native.svgx|.svgx)
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS/index(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.scss|.scss|.native.sass|.sass|.native.less|.less|.native.css|.css|.native.pcss|.pcss|.native.json|.json|.native.styl|.styl|.native.cjs|.cjs|.native.svgx|.svgx)
  15 | import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
  16 | import typeof Button from './Libraries/Components/Button';
> 17 | import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS';
     |                                   ^
  18 | import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
  19 | import typeof FlatList from './Libraries/Lists/FlatList';
  20 | import typeof Image from './Libraries/Image/Image';
    at ModuleResolver.resolveDependency (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:152:15)
    at DependencyGraph.resolveDependency (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/node-haste/DependencyGraph.js:264:43)
    at Object.resolve (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/lib/transformHelpers.js:170:21)
    at resolveDependencies (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/DeltaBundler/graphOperations.js:466:33)
    at processModule (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/DeltaBundler/graphOperations.js:232:31)
    at async addDependency (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/DeltaBundler/graphOperations.js:361:18)
    at async Promise.all (index 1)
    at async processModule (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/DeltaBundler/graphOperations.js:279:3)
    at async addDependency (/Users/shinn/Documents/opensource/taro-playground/node_modules/metro/src/DeltaBundler/graphOperations.js:361:18)
    at async Promise.all (index 0)
Error: Unable to resolve module ./Libraries/Components/DatePicker/DatePickerIOS from /Users/shinn/Documents/opensource/taro-playground/node_modules/react-native/index.js: 

None of these files exist:
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.scss|.scss|.native.sass|.sass|.native.less|.less|.native.css|.css|.native.pcss|.pcss|.native.json|.json|.native.styl|.styl|.native.cjs|.cjs|.native.svgx|.svgx)
  * node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS/index(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.scss|.scss|.native.sass|.sass|.native.less|.less|.native.css|.css|.native.pcss|.pcss|.native.json|.json|.native.styl|.styl|.native.cjs|.cjs|.native.svgx|.svgx)

simulator上就一直白屏。这个该如何解决?谢谢

macos14+xcode14吗

macos14+xcode14吗

@zhiqingchen macOS 13.2.1 (22D68) + xcode v14.3.1

ERROR  Invariant Violation: Tried to register two views with the same name RNSVGRect

需要查看是否存在两个 react-native-svg 版本,并只使用一个

yarn why react-native-svg

@zhiqingchen 执行 yarn upgradePeerdeps 会把 taro-playground package.json 的 react-native-svg 指定为 ~13.7.0 版本,从而跟 package.json resolutions 指定的 "react-native-svg": "~13.10.0" 产生冲突。需要考虑把 Taro 主仓的 @tarojs/rn-supporter@tarojs/components-rn 依赖的 react-native-svg 从 13.7.0 更新到 13.10.0

@Chen-jj ok,main 分支我更新一波。