I wanted to check the version of the react native I was using in my project when I used the command from my root folder :
D:\Reactnative\Albums>npm view react-native version
0.56.0
The version was 0.56.0 which is not the version I have installed, but on:
D:\Reactnative\Albums>react-native -v
react-native-cli: 2.0.1
react-native: 0.55.4
The version mentioned here is 0.55.4, which is correct. So why this conflict?
We are excited to release a new version of React Native, 0.70.
If you type react-native --version inside a project, it will tell you the installed version (tested with react-native-cli v. 2.0. 1).
React 18 enabled by default Starting in React Native 0.69, React 18 is enabled by default when you enable the New Architecture. The means you're able to use the new features in React 18 as soon as you migrate.
npm view react-native version
You can check the latest version of react native. You can run it under the root of your project or everywhere. Of course, you will need internet connection to check latest version.
react-native -v
If you run under the root of project, it will return the version of two npm packages, react-native-cli and react-native. Those versions are using in your project.
Just wanted to clarify Aung's answer:
npm view react-native version
checks globally while react-native -v
ran inside project's root folder checks version of the app itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With