An error occurred during upgrade in react native - react-native

I am working on react native app, started the app using CRNA command to create the project then exp detach to detach. The problem I am having is this: when I started the app I was on windows, so it only created android folder while detaching, now that I want the app to build for iOS I kinda need to generate the iOS folder, to do this I am running react-native-git-upgrade so that it would generate iOS folder, but it throws an error as follow:
An error occurred during upgrade: git-upgrade ERR! Error:
react-native version in "package.json"
(https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz)
doesn't match the installed version in "node_modules" (0.54.2).
Is there any way that I can generate iOS folder without having to upgrade the app? I am so confused in this case and it seems that its quite benefit starting an app from an Mac OS system in this case, so u have both android and iOS folders generated.
Also tried to delete node_modules folder and tried npm install and it seems it added some packages but then again I get same problem when running react-native-git-upgrade
Note: I have node v10.0 installed on Mac
Anyone have any idea on this?

I successfully upgrade RN project using react-native upgrade instead of react-native-git-upgrade, here's the step:
You will be need to input project name in package.json on project root, just add this value "name": "<YOUR-APP-NAME>".
then run react-native upgrade, if you are prompted to downgrade RN package, to downgrade usenpm install react-native#x.x.x, for example: npm install react-native#0.43.4. check installed version using react-native -V.
Now run react-native upgrade, you will be asked to replace some files, input y to confirm.
After the upgrade done, revert to latest version of RN package using npm install react-native#x.x.x.

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.

react-native-camera: sdk manager plateforms-tools 28.0.1 can't be installed

I'm trying to install react-native-camera. I'm on Ubuntu 18, Webstorm for IDE. Targeting Android.
For the Android SDK, I don't have a full Android Studio install. I've instead install only android-sdk and I'm using the sdkmanager. That works fine with my stub app, it compile and runs on Android with
react-native run-android
I've installed react-native-camera as a module with npm as per the indications:
npm install react-native-camera --save
react-native link react-native-camera
So far so good. It links. If I try to launch the app however (even before trying to actually use the camera), I get some warnings:
> Configure project :react-native-camera
Checking the license for package Android SDK Platform-Tools in /usr/lib/android-sdk/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 28.0.1)".
Warning: Failed to read or create install properties file.
WARNING: platform-tools package is not installed, and automatic installation failed.
So I've tried to install the platforms tools using the sdk manager & instructions provided here:
sdkmanager "platform-tools" "platforms;android-28"
Which yields:
Warning: Failed to read or create install properties file.
So I am guessing it really has to do with the sdkmanager...
Do I absolutely need 28.0.1 for react-native-camera? If so, how can I get around this issue with the SDK manager? I've tried various similar syntax for the install of the platform and it didn't work. I checked with sdkmanager --list that it's the proper name (seems to be). And if I go under android-sdk/platforms-tools all I see there is the adb file (or perhaps the install is supposed to just update that file?)
Silly me.
I needed to run the SDK manager as sudo. To do that:
sudo bash sdkmanager [installations args as per post above].
I will leave the post - I lost a ridiculous amount of time for that, hopefully it can help others....
And yes - if the platform-tools install has worked then under /platform-tools you should see a bunch of files, not just the adb one.

react-native run-android not working on ubuntu 16.04

i have a problem with react native in ubuntu, i have installed,
java jdk 8 (both javac --version) as well as echo $JAVA_HOME gives the proper output.
I have also installed android studio and set the android environment variables as well as the tools and echo $ANDROID_HOME gives output of the sdk location.
I have also installed gradle version 4.4.
I am unable to start the android app using react-native run-android. can any one let me know if i have missed something during installation.
And react-native as well as android studio works fine as I am currently using react-native start to start the metro builder as well as the other react-native cli commands. also android studio and gradle is also able to generate debug as well as release apks with no problems.
The error i get,
Scanning folders for symlinks in /home/igate-naveed/Documents/ReactNative/mobile-app-android/node_modules (16ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
First of all you need to create a project like this:
react-native init myProjectName
Then, start an emulator from Android Studio... Afterwards:
npm install && npm start
in your project directory, and from another terminal, inside your project directory, run :
react-native run-android
Is this working?
Instead of using the npm install manager, I used yarn and it worked for me. In your project directory, just do:
(project-directory)$ yarn
Update the gradle version.
Create new project:
react-native init projectname
Uninstall the npm pack.
Reinstall the npm pack again.
npm start
react-native start
react-native run-android

How to downgrade react-native from 0.56.0 to 0.55.4 version?

Actually I am using react-native-camera in my app but it is not working in this version (react-native: 0.56.0) & its working in this version(react-native: 0.55.4).
So now I want to downgrade the react-native: 0.56.0 to react-native: 0.55.4.
My System configuration:
npm 6.1.0,
react-native-cli: 2.0.1,
react-native: 0.56.0,
Mac OS, Xcode 9.3
Thank you
So open the file of your project named as package.json
Inside it you can find react-native": "0.56.4" replace this version with react-native": "0.55.4" or whatever the version you want
Then save the file
Go to the terminal or power sell
Rich to your project directory and run the command npm install
After installation check the version of react-native by running the command react-native --version and make sure that version is which you changed in package.json
Restart your project and you are ready to go
Open the file of your project named as package.json
Inside it you will find react-native": "0.56.0" replace this version with react-native": "0.55.4" or the version which you want to change and save the file
go to the terminal or power sell
Go to your project directory and run command npm install
after installation check the version of react-native by running the command react-native -v and check that the version which you changed in package.json is same as the version you get here, then restart your project.

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