Is 'lockfileVersion: 2' in package-lock.json from npm 7 compatible with older versions of npm?

Thaun_ picture Thaun_ · Feb 11, 2021 · Viewed 16.2k times · Source

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.

Answer

apollo-coder picture apollo-coder · Feb 13, 2021

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