3

I'm trying to learn NPM (and React). I tried migrating a demo site from React 15 to 16.

I ran npm install --save react@^16.0.0 and it worked and updated my package.json file to "react":^16.0.0. I noticed that in package-lock.json, it didn't have the '^' so I added it and ran: npm update react --save and the version stays at 16.0.0 in both files while I'd expect it to update to 16.4.2.

If I run: npm install react --save it'll get the latest version and everything works. From this article it seems like the opposite should be true:

npm install vs. update - what's the difference?

Can anyone shed light as to why this is happening?

Eitan
  • 1,434
  • 6
  • 21
  • 53

0 Answers0