29

I was wondering if the new lockfileVersion 2 was backwards compatable with older versions of NPM.

Now since NPM 7 is released, a new package-lock.json file is regenerated to a different structure. From lockfileVersion 1 to 2.

I would be guessing if it was supported, if adding new packages from old npm lockfile to the new one would not be compatible.

Thaun_
  • 470
  • 1
  • 4
  • 10
  • Refer to the _"not yet published docs"_ [here](https://github.com/npm/cli/blob/653769de359b8d24f0d17b8e7e426708f49cadb8/docs/content/configuring-npm/package-lock-json.md#lockfileversion) in the GitHub repo. Under the _"lockfileVersion"_ section it states: _"[lockfileVersion 2]: The lockfile version used by npm v7, which is backwards compatible to v1 lockfiles."_ – RobC Feb 11 '21 at 15:06

1 Answers1

22

Yes it is, I tried it myself. And here's a remark from the blog:

One change to take note of is the new lockfile format, which is backwards compatible with npm 6 users.

source: https://github.blog/2021-02-02-npm-7-is-now-generally-available/#changes-to-the-lockfile

Riccardo Manzan
  • 703
  • 1
  • 6
  • 19
apollo-coder
  • 371
  • 1
  • 9