Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

npm - Unresolved dependencies on react native

after installed react-native-search-header the app refused to compile as some dependencies were missing.... then I upgraded react native to 0.63.4 (and some other packages with npm-check) which I think was even worst....

Now I have plenty of missing depencies which I do not know how to solve so can compile again....

Here is my package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo-google-fonts/roboto": "^0.1.0",
    "@gorhom/animated-tabbar": "^2.1.0",
    "@react-native-community/checkbox": "^0.5.7",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/native": "^5.9.2",
    "axios": "^0.21.1",
    "babel-preset-es2015": "^6.24.1",
    "expo": "^40.0.1",
    "expo-ads-admob": "~8.4.0",
    "expo-app-loading": "^1.0.1",
    "expo-constants": "^9.3.5",
    "expo-font": "^8.4.0",
    "expo-image-picker": "^9.2.1",
    "expo-localization": "^10.0.0",
    "expo-notifications": "^0.9.0",
    "expo-status-bar": "~1.0.3",
    "i18n-js": "^3.8.0",
    "metro": "^0.64.0",
    "moment-timezone": "^0.5.32",
    "native-base": "^2.15.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-native": "0.63.4",
    "react-native-admob-native-ads": "^0.3.9",
    "react-native-autocomplete-input": "^4.2.0",
    "react-native-country-picker-modal": "^2.0.0",
    "react-native-elements": "^3.1.0",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-material-menu": "^1.2.0",
    "react-native-reanimated": "^1.13.2",
    "react-native-router-flux": "^4.2.0",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.16.1",
    "react-native-search-box": "0.0.20",
    "react-native-search-header": "^0.3.5",
    "react-native-settings-list": "^1.8.0",
    "react-native-status-bar-height": "^2.6.0",
    "react-native-svg": "^12.1.0",
    "react-native-toast-message": "^1.4.3",
    "react-native-user-avatar": "^1.0.7",
    "react-native-web": "^0.14.10",
    "react-redux": "^7.2.2",
    "redux": "^4.0.5",
    "redux-actions": "^2.6.5",
    "redux-connect-decorator": "^0.2.1",
    "redux-logger": "^3.0.6",
    "redux-promise": "^0.6.0",
    "redux-thunk": "^2.3.0",
    "rn-modal-picker": "^0.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "babel-preset-expo": "8.3.0"
  },
  "private": true
}

and also my npm ls:

npm ERR! missing: @react-navigation/native@5.9.2, required by App
npm ERR! missing: react@17.0.1, required by App
npm ERR! peer dep missing: react-native@0.61.5, required by react-native-admob-native-ads@0.3.9
npm ERR! peer dep missing: react-native@^0.60.5, required by react-native-search-header@0.3.5
npm ERR! peer dep missing: react-redux@^4.0.0 || ^5.0.0, required by redux-connect-decorator@0.2.1
npm ERR! missing: expo-constants@^9.3.5, required by App
npm ERR! missing: expo-font@^8.4.0, required by App
npm ERR! missing: metro@^0.64.0, required by App
npm ERR! missing: react-native-safe-area-context@^3.1.9, required by App
npm ERR! peer dep missing: react-native-windows@>=0.62, required by @react-native-community/checkbox@0.5.7
npm ERR! peer dep missing: @unimodules/core@~5.1.2, required by expo-localization@10.0.0
npm ERR! peer dep missing: babel-plugin-transform-decorators@^6.22.0, required by redux-connect-decorator@0.2.1
npm ERR! peer dep missing: babel-plugin-transform-decorators-legacy@^1.3.4, required by redux-connect-decorator@0.2.1
npm ERR! missing: lodash.isequal@4.5.0, required by @gorhom/animated-tabbar@2.1.0
npm ERR! missing: react-native-redash@15.7.3, required by @gorhom/animated-tabbar@2.1.0
npm ERR! missing: abs-svg-path@0.1.1, required by react-native-redash@15.7.3
npm ERR! missing: normalize-svg-path@1.1.0, required by react-native-redash@15.7.3
npm ERR! missing: parse-svg-path@0.1.2, required by react-native-redash@15.7.3
npm ERR! missing: svg-arc-to-cubic-bezier@3.2.0, required by normalize-svg-path@1.1.0
npm ERR! missing: @react-navigation/core@5.15.1, required by @react-navigation/native@5.9.2
npm ERR! missing: escape-string-regexp@4.0.0, required by @react-navigation/native@5.9.2
npm ERR! missing: nanoid@3.1.20, required by @react-navigation/native@5.9.2
npm ERR! missing: escape-string-regexp@4.0.0, required by @react-navigation/core@5.15.1
npm ERR! missing: @react-navigation/routers@5.7.1, required by @react-navigation/core@5.15.1
npm ERR! missing: nanoid@3.1.20, required by @react-navigation/core@5.15.1
npm ERR! missing: query-string@6.13.8, required by @react-navigation/core@5.15.1
npm ERR! missing: react-is@16.13.1, required by @react-navigation/core@5.15.1
npm ERR! missing: nanoid@3.1.20, required by @react-navigation/routers@5.7.1
npm ERR! missing: decode-uri-component@0.2.0, required by query-string@6.13.8
npm ERR! missing: split-on-first@1.1.0, required by query-string@6.13.8
npm ERR! missing: strict-uri-encode@2.0.0, required by query-string@6.13.8
npm ERR! missing: @babel/plugin-proposal-json-strings@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-logical-assignment-operators@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-nullish-coalescing-operator@7.10.4, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-numeric-separator@7.12.7, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-object-rest-spread@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-optional-catch-binding@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-optional-chaining@7.11.0, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-private-methods@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-proposal-unicode-property-regex@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-async-generators@7.8.4, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-class-properties@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-dynamic-import@7.8.3, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-export-namespace-from@7.8.3, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-json-strings@7.8.3, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-logical-assignment-operators@7.10.4, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-nullish-coalescing-operator@7.8.3, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-numeric-separator@7.10.4, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-object-rest-spread@7.8.3, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-optional-catch-binding@7.8.3, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-optional-chaining@7.8.3, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-syntax-top-level-await@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-arrow-functions@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-async-to-generator@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-block-scoped-functions@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-block-scoping@7.12.12, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-classes@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-computed-properties@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-destructuring@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-dotall-regex@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-duplicate-keys@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-exponentiation-operator@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-for-of@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-function-name@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-literals@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-member-expression-literals@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-modules-amd@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-modules-commonjs@7.10.4, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-modules-systemjs@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-modules-umd@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-named-capturing-groups-regex@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-new-target@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-object-super@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-parameters@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-property-literals@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-regenerator@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-reserved-words@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-shorthand-properties@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-spread@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-sticky-regex@7.12.7, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-template-literals@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-typeof-symbol@7.12.10, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-unicode-escapes@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/plugin-transform-unicode-regex@7.12.1, required by @babel/preset-env@7.11.5
npm ERR! missing: @babel/preset-modules@0.1.4, requi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try to check yarn.lock (you should always use "yarn" for install dependencies)

try delete yarn.lock, node_modules and run yarn install

also you may try to edit your metro-config.js

module.exports = {
  ...
  resolver: {
    extraNodeModules: {
     "react-native-search-header": require.resolve('react-native-search-header'),
    },
  },
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...