What is the difference between Expo CLI and Expo SDK - react-native

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.

Related

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.

How to run an old version of react native

Just a quick question, how to run an existing older version of react native project. Lets say version 0.59.10 , without upgrading it. what would be the command line commands. Thanks
You should navigate to project directory (if you aren't yet)
cd PATH_TO_PROJECT_DIRECTORY
run the following command to install the dependencies
npm install
then if the react-native version is 0.59.10 and lowers you should also run the command below to link the dependencies to your native android and ios project.
react-native link
and then run one the following commands based on your device
for android
react-native run-android
for ios
react-native run-ios

Getting error while creating a new Project

I'm new to reactnative. I have followed steps to install reactnative properly but, while creating a new project, I'm getting an error. I'm using Windows 7 64 bit with i3 processor.
c:\ReactNativeProjects>react-native init AwesomeProject
Command npm install --save --save-exact react-native failed.
My Folder contains only one file
Since you are starting to use React Native, consider using Expo, I've used it and it makes developing, debugging, testing and deploying to the apple store and google play easier.
According to the official docs:
Expo is the easiest way to start building a new React Native
application. It allows you to start a project without installing or
configuring any tools to build native code - no Xcode or Android
Studio installation required (see Caveats).
Assuming that you have Node installed, you can use npm to install the
Expo CLI command line utility:
npm install -g expo-cli
Then run the following commands to create a
new React Native project called "AwesomeProject":
expo init AwesomeProject
cd AwesomeProject
npm start
This will start a development server for
you.
I've answered a question in SO for the steps and what happens when you build your .apk and .ipa files using Expo, have a look at that as well.
These are my steps to get rid of this error:
Please upgrade your npm
npm install -g npm#latest
Run npm cache clean command in Command prompt ( With some element of doubt for cache presence)
3.Ran react-native init in command prompt as Administrator (on Windows OS), hoping works well with sudo react-native init on Mac OS
If still problem persist make sure that you have followed each and every step mentioned in Documentation i.e. installed JDK, PYTHON, NODE.
Refer to this link For windows