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.
Related
I created an Expo project because I thought it would be easier to the person I'm teaching to code in React Native. But my instinct is to just use yarn or npm. Am I damaging project structure in any way?
https://docs.expo.dev/workflow/using-libraries/#using-expo-sdk-libraries
The expo install command will pick a version of the library that is compatible with your project and then use your JavaScript package manager (such as npm) to install it.
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?
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.
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.
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