admin管理员组

文章数量:1287818

I used below mand for react app routes.

npm i react-native-router-flux --save

Then i restart npm by "npm start" and get this error

Unable to resolve "react-native-screens" from "node_modules\react-navigation-stack\lib\module\views\StackView\StackViewCard.js" Failed building JavaScript bundle.

How can fix this error? I also updated npm.

This is package.json file

         {
          "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": "~36.0.0",
           "react": "~16.9.0",
           "react-dom": "~16.9.0",
           "react-native": ".0.0.tar.gz",
           "react-native-router-flux": "^4.2.0",
           "react-native-web": "~0.11.7"
          },
          "devDependencies": {
            "babel-preset-expo": "~8.0.0",
            "@babel/core": "^7.0.0"
           },
          "private": true
          }

I used below mand for react app routes.

npm i react-native-router-flux --save

Then i restart npm by "npm start" and get this error

Unable to resolve "react-native-screens" from "node_modules\react-navigation-stack\lib\module\views\StackView\StackViewCard.js" Failed building JavaScript bundle.

How can fix this error? I also updated npm.

This is package.json file

         {
          "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": "~36.0.0",
           "react": "~16.9.0",
           "react-dom": "~16.9.0",
           "react-native": "https://github./expo/react-native/archive/sdk-36.0.0.tar.gz",
           "react-native-router-flux": "^4.2.0",
           "react-native-web": "~0.11.7"
          },
          "devDependencies": {
            "babel-preset-expo": "~8.0.0",
            "@babel/core": "^7.0.0"
           },
          "private": true
          }
Share Improve this question asked Feb 20, 2020 at 21:03 Ehsan ul haqEhsan ul haq 1071 silver badge9 bronze badges
Add a ment  | 

7 Answers 7

Reset to default 2

I used react native official navigation. It really helpful and easy to use. Visit https://facebook.github.io/react-native/docs/navigation

I had the same issue. Noticed that package.json in the repo is missing react-native-screens from the dependencies.

npm i react-native-screens

This is because of the new react-navigation changes. Doing a npm install right now is installing the latest versions instead of the previous versions

You should clear the cache by removing node_module, .expo and package-lock.json and then reinstall all the packages and start the project by using the following mand: expo r -c which should reset the cache and make the project work again as intended.

More Info

Installing following two,

npm install --save @react-native-munity/masked-view
npm install react-native-safe-area-context

it is work for me

or use,

npm install @react-navigation/native

for install 'react-navigation'

I got a similar error after upgrading from React Navigation V3 to V4.

Simply doing

npm i react-native-screens

solved the problem for me.

Install the following dependencies.

@react-native-munity/masked-view
react-native-safe-area-context
expo install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-munity/masked-view

本文标签: