React native's react-navigation is deleting modules - react-native

I am currently working with React Native and I want to use its navigation component. The documentation (https://facebook.github.io/react-native/docs/navigation.html) says I should install react-navigation module for using it, but when I install it
npm install react-navigation
the application stops working the moment it finishes installing. It seems it removes some modules; I get the following output:
added 16 packages, removed 1003 packages and updated 18 packages
Any idea why this is happening? How can this be fixed?

What version of npm are you using? You may be experiencing this bug: https://github.com/npm/npm/issues/17379

Related

React Native app crashes on launch with Invariant Violation

I have a react native app built using Expo and everything was working fine until I had to npm install a package that broke everything. I've uninstalled the said package but the app doesn't seem to work any more. It shows the following invariant violation:
It shows an error Invariant Violation: ListView has been removed from React Native - however, I have not used ListView anywhere in my project. All my lists are through FlatList or VirtualisedList.
Additionally, I'm unable to deduce from the error info about the origin of this error. How do I fix this?
If you have the backup of the code please check the older version of React Native in package.json.
When you do npm install command your React Native version upgraded or may be some other packages.
So, you need to compare the packages with old package.json file. If you found that some packages are updated then you need to remove ^ e.g react-native: ^0.60.0 from package dependencies. This one is the only way to solve this problem.

Problem with new upgraded version(0.60) of react native when we linking any third party module

In my cases when i link third party module in react native like..
npm install react-native-vector-icons --save.
react-native link
It gives message for me....
React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:-
react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
but if i am not link the module it will not work for me
this problem occurs only in react-native new upgraded version(0.60) not for older version.
please suggest me any solution for the given problem.
Always make sure to install any third party library manually rather than doing react-native link.
Follow the detailed manual installation https://github.com/oblador/react-native-vector-icons from here.
Firstly run this command react-native unlink react-native-vector-icons
After unlink is successful, follow the manual installation steps.
Also it's better to use yarn (https://yarnpkg.com/en/) over npm while installing a package.
Hope this helps!
Since react native 0.60 auto-linking is avaliable so that means that future libraries release won't need to run the "link" command. If you're using vector-icons you'll need to wait until the upgrade. You can use the vector icons linked to you project normally, but be careful because that will not be compatible in the next major release in react native. I also tried to upgrade to react native 0.60.3, but this is not the great idea if your using a lot of dependencies.

Which is the correct method of upgrading React Native in your app?

In React Native, what is the difference between:
react-native-git-upgrade
react-native upgrade
yarn upgrade react-native
Just deleting node_modules, bumping the version number in package.json, removing yarn.lock or package-lock.json and doing an npm install or yarn install
What is the preferred method, advantages/disadvantages? Are some outdated? Only relevant for certain versions?
I want to love React Native, but when it comes to versions, it is absolute hell. 0.44.1 is the only version that has consistently worked for me without random fatal errors on startup.
As you can see in here in the official react-native document, the best way for upgrading react-native is using react-native-git-upgrade if you create your project with react-native init. If you started you app with create-react-native-app please read here.
Because React Native projects built with native code are essentially made up of an Android project, an iOS project, and a JavaScript project, upgrading can be rather tricky.
Advantage: The module react-native-git-upgrade provides a one-step operation to upgrade the source files with a minimum of conflicts. Under the hood, it consists in 2 phases:
First, it computes a Git patch between both old and new template
files,
Then, the patch is applied on the user's sources.

Requiring unknown module "object-assign"

Hi i am a newbie to react native, just now installed react and trying to open my first app but it shows error. Please guide me what to do next and why it happens.
Some packages you installed maybe not compatible with the React Native version you used. You can check the peerDependencies of all your dependencies and try to remove dependencies which have a react-native version less than 0.25 in peerDependencies.

Installing npm modules makes flex crash with type errors

I'm attempting to use a component in my React Native project, specifically this one:
https://github.com/lucholaf/react-native-grid-view
I run npm install react-native-grid-view in the project's directory, but as soon as I do that, after building I get:
Is the problem that I'm running npm install in the wrong location? I've tried other directories, but then React doesn't see the modules and says "unknown module".
Thanks!
The problem was that the component was pointing to an older version of React Native, 0.3.4. Manually updated to 0.4 and it worked.