Welcome to OStack Knowledge Sharing 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/[email protected], required by App
npm ERR! missing: [email protected], required by App
npm ERR! peer dep missing: [email protected], required by [email protected]
npm ERR! peer dep missing: react-native@^0.60.5, required by [email protected]
npm ERR! peer dep missing: react-redux@^4.0.0 || ^5.0.0, required by [email protected]
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/[email protected]
npm ERR! peer dep missing: @unimodules/core@~5.1.2, required by [email protected]
npm ERR! peer dep missing: babel-plugin-transform-decorators@^6.22.0, required by [email protected]
npm ERR! peer dep missing: babel-plugin-transform-decorators-legacy@^1.3.4, required by [email protected]
npm ERR! missing: [email protected], required by @gorhom/[email protected]
npm ERR! missing: [email protected], required by @gorhom/[email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: @react-navigation/[email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by @react-navigation/[email protected]
npm ERR! missing: @react-navigation/[email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by @react-navigation/[email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], required by @babel/[email protected]
npm ERR! missing: @babel/[email protected], requi

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

1 Answer

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'),
    },
  },
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...