Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 296
Thaun_ Avatar asked Feb 11 '21 08:02

Thaun_


People also ask

Which npm version is compatible with lockfileVersion 2?

Lockfiles generated by npm v7 will contain lockfileVersion: 2 .

Is lockfileVersion 2 backwards compatible?

Under the "lockfileVersion" section it states: "[lockfileVersion 2]: The lockfile version used by npm v7, which is backwards compatible to v1 lockfiles."

How do I fix package lock json file was created with an old version of npm?

json file was created with an old version of npm Error This issue facing the newest version of npm So that I just downgrade to an older version And the error is solved. Just install the desired version with this command in the console, substitute “V” with your desired version.

Does npm update change package lock json?

npm install will generate a new package-lock. json if it does not exist or it will update the dependency tree if it does not match the packages specified in the package. json . npm ci will install packages based on package-lock.


Video Answer


1 Answers

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

like image 189
apollo-coder Avatar answered Oct 20 '22 16:10

apollo-coder