5

My package-lock.json and package.json do not specify the node.js version used to generate the package-lock.json in my repo.

I can iterate over node versions using nvm to see which one yeilds minimal git diff to the previous package-lock file in my repo. I wonder it there is a less exhaustive and cumbersum way to do that. Are there any hints to "reverse engineer" or "extract" the node-version from the lock file?

Motivation: I don't want to keep changing my package-lock.json at each commit, and also use the same node version in the CI consistently.

Sohail Si
  • 2,750
  • 2
  • 22
  • 36
  • 1
    Can you elaborate a bit more on the "Motivation"? Is `package-lock.json` really changing on each commit? is your node_modules versions are locked (not using ^ or ~)? – Daniel Apr 22 '21 at 10:23
  • 1
    @Daniel I searched this because I have an old electron project that did not use a `.nvmrc` file and I need to know which node ver was used to do `npm i --build-from-source` as i am having issues with apple silicon and some usb dependencies – Daniel Lizik Nov 24 '21 at 08:35
  • did you find an answer to your question? – ZenVentzi Sep 14 '22 at 19:04
  • No. I moved away from that and this question never occurred to me again. But it would be nice if some solution exists. The need was only once for me. – Sohail Si Oct 21 '22 at 09:11

0 Answers0