1

I want to install a package with the latest version whenever I run npm install without specifying a version. e.g. react-datepicker in the following file.

{
    "name": "example",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
      "react": "^16.13.1",
      "react-datepicker": "^2.15.0",
      "react-dom": "^16.13.1",
      "react-scripts": "3.4.1"
    },
    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test",
      "eject": "react-scripts eject"
    }
}

Should I update the version every time when "react-datepicker" releases a new version?

Adam Smith
  • 21
  • 3
  • 1
    A semver of `"*"` would match _any_ version, which would always default to the latest. But that doesn't necessarily mean that running `npm install` would pull in newer versions, because the lockfile will still have a specific version for reproducibility. You're better off using `npm outdated` to keep track of what needs to be updated. – jonrsharpe Jun 15 '22 at 09:34
  • 1
    Does this answer your question? [How to update each dependency in package.json to the latest version?](https://stackoverflow.com/questions/16073603/how-to-update-each-dependency-in-package-json-to-the-latest-version) – bryce Jun 15 '22 at 10:02

0 Answers0