web-profile

React update/upgrade

Show React library versions:

npm list react react-dom react-scripts

package.json:

  • ~ - tilde will update from 1.2.0 to newest patch version 1.2.X
  • ^ - caret will update 1.2.0 to newest minor version 1.X.X
{
  "name": "react-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "^4.0.3",
    "web-vitals": "^1.1.2"
  }
}

Update libraries in package.json:

npm update

Update libraries in package.json and all the local modules:

npm update --save-dev

Fix the vulnerabilities if any:

npm audit fix

Fix the status of vulnerabilities if any:

npm audit

Update all the packages:

npm i -g npm-check-updates
ncu -u
npm install

Leave a Reply

Your email address will not be published. Required fields are marked *