0

I want to lock all versions in package.json, but when I change a version from "^X.Y.Z" to "X.Y.Z" and install packages again, some features break because of older versions. I want to retrieve all versions of installed packages with ^X.Y.X.

Is there a way to update the package.json file for the installed node_modules.

There is a SO thread but can't find a helpful answer.

Update

I'm just currious if their is a utility library to do that labor work for me because in case of huge dependencies list I have to do npm view version for each pkg and then update the obtained version in package.json.

6
  • 1
    You can only change "^X.Y.Z" to "X.Y.Z" in your package.json, not in the package.json of your dependencies. Commented Dec 3, 2021 at 17:07
  • Ok Thanks, Please take a look at the updated question Commented Dec 3, 2021 at 17:20
  • 1
    Is there a reason why you don't have package-lock.json? It serves exact the purpose you asks for and even more: it also locks versions of transient dependencies(dependencies of dependencies) which you'll never achieve with editing package.json Commented Dec 3, 2021 at 17:23
  • Ok Thanks let me try with that Commented Dec 3, 2021 at 18:12
  • Finally I got to the point stackoverflow.com/a/51924601/7344164 Commented Dec 3, 2021 at 19:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.