web-dev-qa-db-ja.com

重複するモジュール名:反応ネイティブ

XCodeプロジェクトでPod Updateを実行しましたが、ダウンロード中のモジュールが重複しているため、プロジェクトはコンパイルされません。誰でも解決策を知っていますか?

Looking for JS files in
   /Users/.../App/Finalv2 


Metro Bundler ready.

Loading dependency graph...jest-haste-map: @providesModule naming collision:
  Duplicate module name: react-native
  Paths: /Users/.../App/Finalv2/node_modules/react-native/package.json collides with /Users/.../App/Finalv2/ios/Pods/React/package.json

This warning is caused by a @providesModule declaration with the same name across two different files.
Loading dependency graph, done.

PDATE:node_modulesフォルダーとpackage.lock.jsonを削除し、npm installを実行しましたが、問題はまだあります

編集:

Package.jsonを追加する

{
  "name": "sample-app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@expo/vector-icons": "^6.2.2",
    "art": "^0.10.1",
    "axios": "^0.17.1",
    "expo": "^24.0.2",
    "firebase": "^4.6.0",
    "lodash": "^4.17.4",
    "moment": "^2.19.3",
    "native-base": "^2.3.3",
    "prop-types": "^15.6.0",
    "react": "^16.3.1",
    "react-native": "^0.55.3",
    "react-native-camera": "^0.10.0",
    "react-native-circular-progress": "git+https://github.com/kk1429/react-native-circular-progress.git",
    "react-native-countdown-circle": "^2.0.0",
    "react-native-country-picker-modal": "^0.5.1",
    "react-native-device-info": "^0.13.0",
    "react-native-easy-grid": "^0.1.16",
    "react-native-elements": "^0.18.5",
    "react-native-fcm": "^11.2.0",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-firebase": "^4.1.0",
    "react-native-linear-gradient": "^2.4.0",
    "react-native-linkedin": "^1.2.1",
    "react-native-material-ui": "^1.19.0",
    "react-native-navigation": "^1.1.471",
    "react-native-progress": "^3.4.0",
    "react-native-pull-refresh": "^1.0.0",
    "react-native-rename": "^2.2.2",
    "react-native-svg": "^5.4.2",
    "react-native-svg-animated-linear-gradient": "^0.1.8",
    "react-native-swiper": "^1.5.13",
    "react-native-tag-input": "git+https://github.com/kk1429/react-native-tag-input.git",
    "react-native-thumbnail-video": "0.0.8",
    "react-native-vector-icons": "^4.4.2",
    "react-native-video": "^2.0.0",
    "react-navigation": "^1.0.0-beta.19",
    "react-redux": "^5.0.6",
    "react-save-refs": "^1.0.2",
    "redux": "^3.7.2",
    "redux-devtools-extension": "^2.13.2",
    "redux-persist": "^5.3.4",
    "redux-thunk": "^2.2.0",
    "whatwg-fetch": "^2.0.3"
  },
  "devDependencies": {
    "babel-jest": "22.1.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.1.4",
    "react-test-renderer": "16.2.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

UPDATE

npm installを実行すると、奇妙なエラーが発生します

> [email protected] install /Users/.../App/Finalv2/node_modules/fsevents
> node install

[fsevents] Success: "/Users/.../App/Finalv2/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> [email protected] install /Users/kaaddevelopers/Documents/Clipme/App/Finalv2/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-darwin-x64-unknown.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
31
Kamil Kamili

解決策を探すのにしばらく時間を費やし、ようやく機能するものを見つけました!私はFirebaseを使用していませんが、ここでの議論は役に立ちました: https://github.com/invertase/react-native-firebase/issues/414 あなたは2行を追加する必要がありますポッドファイル。

# Add these to your Podfile
pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

次に、次を実行して、CocoaPodsを再インストールしたことを確認します。

cd ios
rm -rf Pods
pod install
132
Dehli

試してください:

  1. watchman watch-del-all
  2. rm -fr $TMPDIR/react-*
  3. erase jest-cache folder
  4. rm -rf node_modules
  5. npm install
  6. npm cache clean && npm start -- --reset-cache

更新

最新のノードjsをダウンロードする を試して、npm install -g npmを実行します

2
MohamadKh75

私の場合、ポッドでライブラリをリンクしているため、ポッドに自動インストールされます。だから私は私のポッドファイルを更新しました:

target 'MyProject' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  rn_path = '../node_modules/react-native'
  pod 'React', path: rn_path, subspecs: [
   'Core',
   'CxxBridge',
   'DevSupport',
   'RCTActionSheet',
   'RCTAnimation',
   'RCTGeolocation',
   'RCTImage',
   'RCTLinkingIOS',
   'RCTNetwork',
   'RCTSettings',
   'RCTText',
   'RCTVibration',
   'RCTWebSocket',
 ]
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
//Another libraries here
  pod 'RNImageTools', :path => '../node_modules/react-native-image-tools-wm'


  post_install do |installer|
    installer.pods_project.targets.each do |target|

      # The following is needed to ensure the "archive" step works in XCode.
      # It removes React & Yoga from the Pods project, as it is already included in the main project.
      # Without this, you'd see errors when you archive like:
      # "Multiple commands produce ... libReact.a"
      # "Multiple commands produce ... libyoga.a"

      targets_to_ignore = %w(React yoga)

      if targets_to_ignore.include? target.name
        target.remove_from_project
      end

    end
  end

end

次に、Podsフォルダーを削除して、pod installを実行します。そのすべて。

0

@Dehliの答えに加えて、これは次の場合に発生する可能性があります:

  1. 反応ネイティブモジュールの「依存関係」として反応ネイティブを持っている

    解決策:react-nativeをpackage.jsonの「peerDependency」に移動します

  2. PeerDependencyに移動し、アプリケーションのpackage-lock.jsonにモジュールへの依存関係としてreact-nativeをリストさせました。

    解決策:アプリケーションでpackage-lock.jsonを削除し、npm_modulesフォルダーを消去して、npm installを再度実行します

0
TheJoker

「Pod」フォルダー内の「React」フォルダーを削除します

最後のendの後の一番下のポッドファイル内にこれを追加します

post_install do |installer|
  installer.pods_project.targets.each do |target|

# The following is needed to ensure the "archive" step works in XCode.
# It removes React & Yoga from the Pods project, as it is already included in the main project.
# Without this, you'd see errors when you archive like:
# "Multiple commands produce ... libReact.a"
# "Multiple commands produce ... libyoga.a"

    targets_to_ignore = %w(React yoga)

    if targets_to_ignore.include? target.name
      target.remove_from_project
    end

  end
end

Podsフォルダーを削除してからpod installに移動します

0
Cyrus Zei