Uday
Uday

Reputation: 57

npm error while installing package in reactjs

When I try to install any npm package, I get the following error. And the installation gets stuck.

I've pasted the error below

Error msg:

This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

Error screenshot

Help me to solve this problem. Thanks in Advance.

Upvotes: 0

Views: 378

Answers (1)

0xBobby
0xBobby

Reputation: 311

The error message you mentioned is due to the fact that you are running an older version of npm. You are probably on v5 or v6 while your package-lock.json was generated with v7+.

However, that message is usually a warning, and not a final error. Would double check to see if you have other error messages as well.

More details for package-lock.json versions at: https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion

Upvotes: 1

Related Questions