简体   繁体   中英

React Native Navigator

I created a basic react native app just to practice. As a first step, I followed the docs below to create a navigation from one page to another:

https://reactnative.dev/docs/navigation

I'm using React Native CLI, and installed:

npm install @react-navigation/native @react-navigation/native-stack

npm install react-native-screens react-native-safe-area-context

and I copied the code from the docs to my App.js file. When I'm hitting npx react-native run-android, I'm getting the following error:

error: Error: Unable to resolve module react-navigation from C:\\Users\\sh\\NewProject\\App.js: react-navigation could not be found within the project or in these directories: node_modules

I tried to delete node_modules and did npm install - didn't help.

Any idea how to resolve this? thanks

This error comes when library is not linked up or properly not imported. Please uninstall and try to install it again step by step.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM