世博会回应本地同行的依赖

时间:2018-07-18 13:30:04

标签: react-native expo package.json

自sdk 28世博会升级以来,我遇到了问题。

警告:缺少“本机”对等依赖项。在/ Users / macbook / Desktop / eventlinn中运行npm ls,以查看完整警告。 警告:“反应”对等项依赖项缺失。在/ Users / macbook / Desktop / eventlinn中运行npm ls,以查看完整警告。

我的package.json这样

"dependencies": {
    "@expo/samples": "2.1.1",
    "axios": "^0.18.0",
    "expo": "^28.0.0",
    "impagination": "^1.0.0-alpha.3",
    "moment": "^2.22.2",
    "native-base": "^2.7.1",
    "pod": "^0.9.0",
    "react": "^16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-28.0.0.tar.gz",
    "react-native-camera": "^1.1.4",
    "react-native-datepicker": "^1.7.2",
    "react-native-dismissable-numeric-keyboard": "^0.1.0",
    "react-native-elements": "^0.19.1",
    "react-native-fcm": "^6.2.3",
    "react-native-firebase": "^4.2.0",
    "react-native-flexi-radio-button": "^0.2.2",
    "react-native-google-places": "^2.5.2",
    "react-native-keyboard-aware-scroll-view": "^0.6.0",
    "react-native-modal-datetime-picker": "^5.1.0",
    "react-native-modal-dropdown": "^0.6.2",
    "react-native-modal-picker": "0.0.16",
    "react-native-modal-selector": "0.0.27",
    "react-native-select-input-ios": "^1.2.0",
    "react-navigation": "~2.3.1",
    "react-timer-mixin": "^0.13.3",
    "util": "^0.10.3",
    "watchman": "^1.0.0",
    "yarn": "^1.7.0"
  }

2 个答案:

答案 0 :(得分:0)

首先从依赖项下面更新依赖项版本,然后在您的依赖项中添加其他必需的依赖项:

{
  "name": "nativebasedemo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
    "newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
    "test:watch": "jest --watch",
    "lint": "eslint ./App",
    "lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
    "fixcode": "eslint --fix ./App",
    "git-hook": "npm run lint -s && npm run test -s",
    "rm-node": "rm -rf node_modules && npm install"
  },
  "dependencies": {
    "lodash": "^4.17.10",
    "native-base": "^2.4.4",
    "prop-types": "^15.6.1",
    "react": "16.3.2",
    "react-native": "^0.55",
    "react-native-easy-grid": "^0.2.0",
    "react-navigation": "2.2.5"
  },
  "devDependencies": {
    "babel-core": "6.26.0",
    "babel-eslint": "^8.2.5",
    "babel-jest": "22.4.3",
    "babel-plugin-ignite-ignore-reactotron": "^0.3.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react-native": "^3.0.2",
    "eslint": "^4.19.1",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.10.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.7.0",
    "jest": "22.4.3"
  },
  "jest": {
    "testMatch": [
      "<rootDir>/Tests/**/*.js",
      "**/?(*.)(spec|test).js?(x)"
    ],
    "testPathIgnorePatterns": [
      "/node_modules/",
      "<rootDir>/Tests/Setup.js"
    ],
    "moduleNameMapper": {
      "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
    },
    "setupFiles": [
      "<rootDir>/Tests/Setup"
    ],
    "preset": "react-native"
  }
}

答案 1 :(得分:0)

我遇到了一个类似的问题,reactreact-native都存在。 最终将native-base的版本锁定为2.6.1

通过这种方式,native-base不需要更高的版本,而sdk-28.0.0.tar.gz没有更高的版本。