首页 文章

更新react-native-maps以使用create-react-native-app

提问于
浏览
0

当我运行create-react-native-app时,我得到react-native-maps的peer依赖项,以使用react-native@0.54 . 我需要能够使用react-native@0.55.2和react@16.3.1

下面给出的是react-native-maps的package.json文件 . 注意第81,82,97和98行

有人可以展示如何编辑这个json文件以及如何更新react-native-maps?当我尝试:

npm --depth 9999 update

我最终得到了关于重复包的大量错误 .

{
  "_from": "react-native-maps@0.21.0",
  "_id": "react-native-maps@0.21.0",
  "_inBundle": false,
  "_integrity": "sha512-FkCCV1AyaT5ut5ZTKNIdFWBxRUXZovGTydy7U4Cyifj2dv0Q3Sv21B0Myj+aoGhJhvBJzxsU25dDGQN3TP7b/Q==",
  "_location": "/react-native-maps",
  "_phantomChildren": {
    "babel-plugin-check-es2015-constants": "6.22.0",
    "babel-plugin-syntax-async-functions": "6.13.0",
    "babel-plugin-syntax-class-properties": "6.13.0",
    "babel-plugin-syntax-flow": "6.18.0",
    "babel-plugin-syntax-jsx": "6.18.0",
    "babel-plugin-syntax-trailing-function-commas": "6.22.0",
    "babel-plugin-transform-class-properties": "6.24.1",
    "babel-plugin-transform-es2015-arrow-functions": "6.22.0",
    "babel-plugin-transform-es2015-block-scoping": "6.26.0",
    "babel-plugin-transform-es2015-classes": "6.24.1",
    "babel-plugin-transform-es2015-computed-properties": "6.24.1",
    "babel-plugin-transform-es2015-destructuring": "6.23.0",
    "babel-plugin-transform-es2015-for-of": "6.23.0",
    "babel-plugin-transform-es2015-function-name": "6.24.1",
    "babel-plugin-transform-es2015-literals": "6.22.0",
    "babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
    "babel-plugin-transform-es2015-parameters": "6.24.1",
    "babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
    "babel-plugin-transform-es2015-spread": "6.22.0",
    "babel-plugin-transform-es2015-template-literals": "6.22.0",
    "babel-plugin-transform-flow-strip-types": "6.22.0",
    "babel-plugin-transform-object-assign": "6.22.0",
    "babel-plugin-transform-object-rest-spread": "6.26.0",
    "babel-plugin-transform-react-display-name": "6.25.0",
    "babel-plugin-transform-react-jsx": "6.24.1",
    "babel-plugin-transform-react-jsx-source": "6.22.0",
    "babel-plugin-transform-regenerator": "6.26.0",
    "lodash": "4.17.10",
    "react-transform-hmr": "1.0.4"
  },
  "_requested": {
    "type": "version",
    "registry": true,
    "raw": "react-native-maps@0.21.0",
    "name": "react-native-maps",
    "escapedName": "react-native-maps",
    "rawSpec": "0.21.0",
    "saveSpec": null,
    "fetchSpec": "0.21.0"
  },
  "_requiredBy": [
    "/expo"
  ],
  "_resolved": "https://registry.npmjs.org/react-native-maps/-/react-native-maps-0.21.0.tgz",
  "_shasum": "005f58e93d7623ad59667e8002101970ddf235c2",
  "_spec": "react-native-maps@0.21.0",
  "_where": "d:\\atestbed\\native-react\\lecture4-contacts\\node_modules\\expo",
  "author": {
    "name": "Leland Richardson",
    "email": "leland.m.richardson@gmail.com"
  },
  "bugs": {
    "url": "https://github.com/airbnb/react-native-maps/issues"
  },
  "bundleDependencies": false,
  "dependencies": {
    "babel-plugin-module-resolver": "^2.3.0",
    "babel-preset-react-native": "1.9.0"
  },
  "deprecated": false,
  "description": "React Native Mapview component for iOS + Android",
  "devDependencies": {
    "babel-eslint": "^6.1.2",
    "babel-preset-airbnb": "^1.1.1",
    "eslint": "^3.3.1",
    "eslint-config-airbnb": "^10.0.1",
    "eslint-plugin-import": "^1.14.0",
    "eslint-plugin-jsx-a11y": "^2.1.0",
    "eslint-plugin-prefer-object-spread": "^1.1.0",
    "eslint-plugin-react": "^6.1.2",
    "gitbook-cli": "^2.3.0",
    "lodash": "^4.17.2",
    "prop-types": "^15.5.10",
    "react": "^16.3.0-alpha.1",
    "react-native": "^0.54"
  },
  "homepage": "https://github.com/airbnb/react-native-maps#readme",
  "keywords": [
    "react",
    "react-native",
    "react-component",
    "map",
    "mapview",
    "google-maps",
    "mapkit"
   ],
  "main": "index.js",
  "name": "react-native-maps",
  "peerDependencies": {
    "react": "^16.0",
    "react-native": "^0.51 || ^0.52 || ^0.53 || ^0.54",
    "prop-types": "^15.0 || ^16.0"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/airbnb/react-native-maps.git"
  },
  "rnpm": {
    "android": {
      "sourceDir": "./lib/android"
    }
  },
  "scripts": {
    "build": "npm run build:js && npm run build:android && npm run build:ios",
    "build:android": "./gradlew :react-native-maps:assembleDebug",
    "build:ios": "bundle install --path ./example/ios/bundles && bundle exec pod install --project-directory=./example/ios/",
    "build:js": "exit 0",
    "ci": "npm run lint",
    "lint": "eslint ./",
    "preversion": "./scripts/update-version.js",
    "run:android": "./gradlew installDebug && npm run start:android",
    "run:ios": "react-native run-ios --project-path ./example/ios",
    "run:packager": "./node_modules/react-native/packager/packager.sh",
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "start:android": "adb shell am start -n com.airbnb.android.react.maps.example/.MainActivity"
  },
  "version": "0.21.0"
}

1 回答

  • 0

    好的,所以如果我们只是通过以下方式更新react-native-maps的package.json文件:

    under devDependencies:
        "react": "^16.3.1",
        "react-native": "^0.55.2"
    
    under peerDependencies:
        "react": "^16.3.1",
        "react-native": "^0.55",
    

    然后回到顶层项目安装eslint@4.0.0和ajv@6.0.0并将它们添加到package.json中的依赖项 .

相关问题