重复的模块名称:react-native [英] Duplicate Module Name: react-native

查看:334
本文介绍了重复的模块名称:react-native的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在XCode项目中运行了 Pod Update ,现在由于下载了重复的模块,我的项目无法编译。有人知道任何解决方案吗?

I ran Pod Update in my XCode Project and now my project isn't compiling due to duplicate modules being downloaded. Anyone know any solutions?

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.

更新:
我删除了 node_modules 文件夹和 package.lock.json 并运行 npm install ,但问题是仍然存在

UPDATE: I deleted my node_modules folder and package.lock.json and ran npm install but the issue is still there

编辑:

添加我的包裹.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/"
    ]
  }
}

更新

运行 npm install 会产生奇怪的错误

> fsevents@1.2.4 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

> grpc@1.10.1 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 grpc@1.10.1 and node@10.1.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)


推荐答案

我花了一些时间寻找解决方案,终于找到了可行的方法!我没有使用Firebase,但是这里的讨论可以提供帮助: https:/ /github.com/invertase/react-native-firebase/issues/414 您必须在Podfile中添加两行。

I just spent some time searching around for a solution and finally found something that worked! I'm not using Firebase, but the discussion here was able to help: https://github.com/invertase/react-native-firebase/issues/414 You have to add two lines to your Podfile.

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

然后运行以下命令以确保您重新安装CocoaPods。

Then run the following to make sure you reinstall your CocoaPods.

cd ios
rm -rf Pods
pod install

这篇关于重复的模块名称:react-native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆