Home > Mobile >  can't find '@react-navigation/stack' module in ReactNative Project
can't find '@react-navigation/stack' module in ReactNative Project

Time:03-20

I changed my npm global root and it's such a mess .. now this is my npm list,, and I have react-navigation in it but it doesn't work.

npm list
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
C:\Users\20wjs
 -- UNMET DEPENDENCY @babel/[email protected]
 -- @react-navigation/[email protected]
|  -- @react-navigation/[email protected]
| |  -- @react-navigation/[email protected]       
| | | `-- [email protected] deduped
| |  -- [email protected] deduped    
| |  -- [email protected] deduped
| |  -- [email protected]
| | |  -- [email protected]
| | |  -- [email protected]
| | |  -- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
|  -- [email protected]
|  -- [email protected]
| `-- [email protected]
 -- @react-navigation/[email protected]
|  -- @react-navigation/[email protected]
|  -- [email protected]
| |  -- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
| |    -- [email protected] deduped
| |   `-- [email protected]
| |     `-- [email protected]
| `-- [email protected]
 -- @types/[email protected]
|  -- @types/[email protected]
|  -- @types/[email protected]
| `-- [email protected]
 -- @types/[email protected]
| `-- @types/[email protected] deduped
 -- @types/[email protected]
| `-- @types/[email protected] deduped
 -- @types/[email protected]
|  -- @types/[email protected]
| |  -- @types/[email protected] deduped
| | `-- [email protected] deduped
|  -- @types/[email protected] deduped
| `-- [email protected] deduped
 -- @types/[email protected]
|  -- @types/[email protected] deduped
|  -- @types/[email protected]
| | `-- @types/[email protected] deduped
| `-- @types/[email protected] deduped
 -- UNMET DEPENDENCY [email protected]
 -- UNMET DEPENDENCY [email protected]
 -- UNMET DEPENDENCY [email protected]
|  -- @egjs/[email protected]
| | `-- @types/[email protected]
|  -- [email protected]
| | `-- [email protected] deduped
|  -- UNMET DEPENDENCY [email protected]
| | `-- UNMET DEPENDENCY [email protected]
| |   `-- UNMET DEPENDENCY [email protected]
|  -- [email protected]
| `-- UNMET DEPENDENCY [email protected]
|    -- UNMET DEPENDENCY [email protected]
|    -- [email protected]
|   `-- [email protected] deduped
 -- [email protected]
|  -- @callstack/[email protected]
| |  -- [email protected]
| | `-- [email protected] deduped
|  -- [email protected] deduped
| `-- [email protected]
 -- UNMET DEPENDENCY [email protected]
|  -- @babel/[email protected]
| | `-- @babel/[email protected]
|  -- @types/[email protected]
|  -- UNMET DEPENDENCY [email protected]
|  -- [email protected]
|  -- [email protected]
|  -- [email protected] deduped
| `-- [email protected]
 -- [email protected] extraneous
 -- [email protected]
|  -- [email protected]
| `-- [email protected] deduped
 -- UNMET DEPENDENCY [email protected]
 -- [email protected]
|  -- @react-navigation/[email protected]
| |  -- [email protected] deduped
| |  -- [email protected]
| | | `-- [email protected]
| |  -- [email protected]
| | |  -- [email protected] deduped
| | |  -- [email protected] deduped
| | |  -- [email protected] deduped
| | | `-- [email protected] deduped
| | `-- [email protected] deduped
| `-- @react-navigation/[email protected]
|    -- [email protected] deduped
|   `-- [email protected]
|     `-- [email protected]
 -- [email protected]
`-- [email protected]

npm ERR! missing: @babel/[email protected], required by 20wjs
npm ERR! missing: [email protected], required by 20wjs
npm ERR! missing: [email protected], required by 20wjs
npm ERR! missing: [email protected], required by 20wjs
npm ERR! missing: [email protected], required by 20wjs
npm ERR! missing: [email protected], required by 20wjs
npm ERR! extraneous: @babel/[email protected] C:\Users\20wjs\node_modules\@babel\preset-env
npm ERR! extraneous: [email protected] C:\Users\20wjs\node_modules\react
npm ERR! extraneous: [email protected] C:\Users\20wjs\node_modules\react-native
npm ERR! extraneous: [email protected] C:\Users\20wjs\node_modules\react-native-safe-area-context      
npm ERR! extraneous: [email protected] C:\Users\20wjs\node_modules\react-native-vector-icons
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: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]

And this is my package.json

{
  "name": "healthreactnative",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.67.2"
  },
  "devDependencies": {
    "@babel/core": "^7.17.5",
    "@babel/runtime": "^7.17.2",
    "@react-native-community/eslint-config": "^3.0.1",
    "babel-jest": "^27.5.1",
    "eslint": "^8.9.0",
    "jest": "^27.5.1",
    "metro-react-native-babel-preset": "^0.68.0",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": ["./src/main/assets/fonts"]
  }
}


Can anyone help me..?? Do I lost some modules in node_modules? How can I handle this?? Can you give me some tips how to see this error? How can I install some missing things??

CodePudding user response:

If you run npm install, it tries to pick up the dependencies to install from your package.json. But the problem is @react-navigation/stack is not there.

You need to install that dependency in order to use it. Thus try to install that module like the following:

npm install @react-navigation/stack

CodePudding user response:

You need to install @react-navigation/stack and react-native-gesture-handler, again, as per your package.json file, these are missing there. Moreover, i can see other modules missing from your package.json, Simply install them and they will add up to your package.json dependencies. This might solve your issues of missing modules. Ill recommend, dont delete your node_modules folder right away, take notes/list of modules required by your project and npm install them.

  • Related