expo install vs npm install - react-native

I'm just getting started with Expo -- but I've done RN development using the CLI. One of the first things I noticed is that I am supposed to install third party packages using expo install <package-name> so that we know the package is compatible.
However, I just noticed that even though Expo recommends React Navigation for navigation and routing, the first step in installing it is npm install #react-navigation/native. We then continue with expo install for installing Expo dependencies. Here's the instructions: https://reactnavigation.org/docs/getting-started/
I'm a bit confused here. I thought we weren't supposed to use npm install with Expo. What am I missing? Why are we using npm install for the React Navigation package and not expo install?

Related

What is the difference between Expo CLI and Expo SDK

I am working on expo project by following online tutorials. I used npm install -g expo-cli to install the CLI. I also used expo init AwesomeProject to initialize a new expo project. Later i came to know that there is something called expo SDK and the latest version as of today is 42. So, i decided to check mine using expo --version. I got 4.3.2 as result and i can upgrade it to 4.9.1 by running npm install -g expo-cli. I realized that it is nothing do to with SDK version. Now i am confused with expo CLI and SDK because the tutorial doesn't even tell anything about SDK. Is it important to know about expo SDK ? and what's the difference between expo CLI and expo SDK and how to check its version? Thanks.
As far as I know, each version of Expo CLI is dependent on an SDK version and many other dependencies, and you should not update any dependency separately. You should wait for a new version of Expo CLI and when updating, probably, it will also update the version of the SDK. Expo CLI is just a command line that put together all expo dependencies and facilitates his installation in new projects. Expo SDK is the actual software that you use when you start expo and that gives your app access to multiple APIs.
Expo CLI is the set of commands that you use to interact with the Expo ecosystem to build, run and deploy your app. For ex: expo init, expo install, expo start, expo eject etc., commands are all part of the CLI.
Expo SDK is the set of packages that you 'import' for building your app. For eg: expo-location, expo-calendar are all packages that are part of SDK: Check out: https://docs.expo.dev/versions/v43.0.0/sdk/. The set of packages and their functionality vary for each SDK version.
When you run a command like
expo install expo-location
, you are using the expo's install command to install expo-location package for the SDK you are currently on.

getting started with Vue native

I've installed Vue-native-cli
Do I need to install expo-cli and react-native-cli to use build project with vue native?
I've been seeing errors like
Expo not found and
React, React-dom not found when I run the command
vue-native init <projet name>
As it's written in the documentation: expo-cli or react-native-cli
System Requirements
Globally installed node >= 6.0
Globally installed npm >= 4.0
Globally installed Expo CLI OR React Native CLI
The information above can be found here
Edit: Not sure if I missunderstood to use build project. If you mean your project is already built (it's an APK file), then it's not needed to install the additional package. To run it, you can use android emulator, (for example BlueStacks) or transfer the app to your phone.

How do I update npm packages in Expo

In my regular React Native projects, I run npm update {package-name} regularly to make sure my libraries are up-to-date. For example, I use a third party user authentication package and want to make sure that I use the latest stable version.
What is the Expo equivalent of npm update?
I understand using expo install {package-name} has an advantage over npm i {package-name} in that it makes sure the installed version of the package will be compatible with Expo SDK the app is using. That's why I'm reluctant to run npm update {package-name} and want to put Expo in the equation.
How do I update my npm packages in my Expo app?
expo only updates the third packages with the core update of expo sdk, so you have to wait to ensure the compatibily.
Run expo upgrade
according to your expo sdk,
here is the last one so far
follow https://blog.expo.dev/expo-sdk-45-f4e332954a68

When to use expo, npm and yarn while writing commands in terminal?

There are two parts to this question:
I have recently started working on react-native and I am struggling to understand where do we use npm, expo, npx or yarn. I am working on a mac machine and trying to run my app on ios simulator.
Once globally if I install react-native, Am I required it independently in each project when I create.
You can create your own app through expo cli or react-native-cli.
There are some advantages and disadvantages on both cli.
Both cli recommend you to install dependency packages through npm or yarn. So you can use anyone. If you notice the doc of react-native, you can see that packages installation instructions are provided for both npm and yarn.
Advantage of expo-cli
You can run your app through expo client's app, no need to install the apk.
Also after running your app with expo-cli you can run your app by scanning the QR code.
The main disadvantage of expo-cli is, normal hello-world app's apk file is too big.
Advantage of react-native-cli
You can fully control your app on this cli
App's size is not too big as expo-cli
You can't run your app through QR code like expo. You have to install the apk file.
Also there are more advantages and disadvantages both cli have. I am using react-native-cli.
Hope this would be helpful for you. Thank you.

Modules from #react-native-community

It took me quite a few days to figure out I need to install the latest react-native cli from #react-native-community/cli but not from react-native-cli as I used to do.
Do:
yarn add #react-native-community/cli
but not:
yarn add react-native-cli
There are quite many modules now under #react-native-community, my question is that when I should install from #react-native-community/module_name and when just react-native-modulename.
Lots of libraries used to be a part of react-native library, but recently they decided to move them out. So now modules like react-native-camera can be installed via npm install react-native-camera and then imported from react-native-camera package.
It's easy to understand when to install a package from npm and when just import from react-native. If your import tells you that there is no such module in core lib, just go to npm and check it there.