The error “Npm WARN old lockfile The package-lock.json file was created with an old version of npm” relates to the conflict between your node file and npm. So how to fix it? Let’s go into detail.
What causes error?
The error happens because of a conflict between your npm version and versus node version. For example, when you try to use npm version lower 7 with NodeJS version later 14.
Example For Error:
How to fix error “Npm WARN old lockfile The package-lock.json file was created with an old version of npm”
Solution 1: Use nvm
nvm, which stands for node version manager, can help you to use multiple version node js on a computer. So you can change your node js version to a suitable version with npm. To use nvm, there are some steps below:
- Step 1: Uninstall node js
Nvm will help you install node js, so you will have to uninstall your current version of node js. You simply uninstall nodeJS like an ordinary app.
- Step 2: Install nvm
You can install nvm here. There are a lot of ways to install nvm, but I recommend you install it by zip file. It is easier.
- Step 3: Install node JS
You can install NodeJS by simple command nvm install (node_version) or nvm install latest.
nvm install 14.0.0 Downloading node.js version 14.0.0 (64-bit)... Complete Downloading npm version 6.14.4... Complete Installing npm v6.14.4... Installation complete. If you want to use this version, type nvm use 14.0.0
You can use nvm list to check all the node versions on your computer.
nvm list * 18.9.0 (Currently using 64-bit executable) 16.17.0 14.0.0
Here I already have three versions 18.9.0, 16.17.0, and 14.0.0. You can check all node version releases and pick the one you want here. Now I am using node version 16.17.0. If you want to switch to version 18.9.0, you can use the command nvm use (node_version).
>nvm use 14.0.0 Now using node v14.0.0 (64-bit)
If you get an error like this:
You can fix it by run the terminal as administrator.
Solution 2: Ignore it
It’s just a warning that doesn’t stop your code or something, so you don’t have to worry about it.
In this tutorial, I have shown you how to deal with the warning “npm WARN old lockfile the package-lock.json file was created with an old version of npm”. You might want to change the version of npm or node. You can change it easier by using nvm. You can also ignore it because it is not a big problem.
Maybe you are interested:
- Create React App requires Node 14 or higher. Please update your version of Node
- Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist
- Require(…) is not a function TypeError in Node.js
Name of the university: HOU