1

I have a react project and I want to update this outdated package

   npm outdated
   Package                           Current           Wanted  Latest  
   Location
   native-base                         2.3.1            2.4.3   2.4.3  
   react                     16.0.0-alpha.12           16.3.2  16.3.2  
   expo                               20.1.2           20.1.4  27.0.1  
   jest-expo                          20.0.0           20.0.0  27.0.1  
   react-native                       0.47.2           0.47.2  0.55.3  
   react-native-calendars             1.14.2           1.19.3  1.19.3  
   react-native-collapsible            0.9.0            0.9.0  0.11.2  
   react-native-datepicker             1.6.0            1.7.2   1.7.2  

First question, what is the difference between "Current" and "Wanted"?And, exactly, what I have to do? If I do "npm update", the result is:

npm WARN react-native@0.47.2 requires a peer of react@16.0.0-alpha.12 but 
none is installed. You must install peer dependencies yourself.
npm WARN react-native-elements@0.16.0 requires a peer of react-native- 
vector-icons@^4.2.0 but none is installed. You must install peer 
dependencies yourself.
npm WARN react-native-svg@5.3.0 requires a peer of react@16.0.0-alpha.12 
but none is installed. You must install peer dependencies yourself.
npm WARN react-native-keyboard-aware-scroll-view@0.5.0 requires a peer of 
react-native@>=0.48.4 but none is installed. You must install peer 
dependencies yourself.

And I do not understand if npm has updated something...

lucacatr
  • 101
  • 3
  • 12

1 Answers1

0

As mentioned in the docs

Current: The current version that you are having.

Wanted: is the maximum version of the package that satisfies the semver range specified in package.json.If there's no semver range available then wanted shows the currently-installed version, where semver means single major version, major version or minor version. You can read more about it here.

npm update will install the packages to the latest version respecting semver and also modify the package.json.

This means that if you have a package version 1.0.2 whose latest version is 3.0.2, then it'll respect semver and upgrade it to latest minor version only.

For this you may either make a script to remove node_modules and reinstall them to latest as mentioned here or use npm-check-updates as mentioned in this post

For upgrading major packages this approach is not recommended since some libraries may or may not be compatible with the latest version of other libraries which they use as a dependency.

Ideally you should upgrade your react-native version using react-native-git-upgrade as mentioned here and then update all the dependencies

Pritish Vaidya
  • 21,561
  • 3
  • 58
  • 76