5

I just did a clean clone of my repo, did npm install and then pod install in the ios/ directory. This leads to a change in my Podfile.lock, which seemed to have upgraded a couple of modules to a newer version than what is specified in the package.json for that corresponding module, for example:

Podfile.lock:

-  - react-native-webview (8.1.0):
+  - react-native-webview (8.2.1):

package.json:

"react-native-webview": "^8.1.0",

I would like to understand why this happens and whether this is a problem. I would avoid this but I can't do npm run ios, because it says that there are version issues and I have to run pod install.

ffritz
  • 2,180
  • 1
  • 28
  • 64
  • I am also having same trouble, versions are not syncing between package.json and Podfile.lock. Did you find any solution yet ? – kernelman May 16 '21 at 06:14

2 Answers2

1

When i get deep issues with Podfile/package.json, i do something like that:

  1. Delete ./node_modules;
  2. Delete package-lock.json and Podfile.lock;
  3. Set a fixed version to component: "^8.1.0" -> "8.1.0" [w/o ^];
  4. Do the npm install then pod install.
Maycon Mesquita
  • 4,470
  • 2
  • 21
  • 29
1

The magic character is ^:

“Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. ^1.2.3 will use releases from 1.2.3 to <2.0.0.

See this answer for further details.


In your package.json it is defined that your project uses for react-native-webview at least version 8.1.0 and less than 9.0.0.

So if you would check your package-lock.json file (or yarn.lock), then most probably the version of react-native-webview would be 8.2.1 as well.

The versions of podfile.lock and package-lock.json don't differ.


If you really want to have THAT version you specified in the package.json, then the third step of the suggested answer of Maycon Mesquita is correct. Pin the version without the ^.