[Solved] npm notice created a lockfile as package-lock.json. You should commit this file

I have been trying to load the skeleton of express with npm install express. It outputs the following line:

npm notice created a lockfile as package-lock.json. You should commit this file.

What should I do in order to load the template ejs and css engine automatically?

Solution #1:

Yes. You should add this file to your version control system, i.e. You should commit it.

This file is intended to be committed into source repositories

You can read more about what it is/what it does here:

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.

Respondent: zoecarver

Solution #2:

You can update the existing package-lock.json file instead of creating a new one. Just change the version number to a different one.

{ "name": "theme","version": "1.0.1", "description": "theme description"}
Respondent: Rahul Mankar

Solution #3:

Yes it is wise to use a version control system for your project.
Anyway, focusing on your installation warning issue you can try to launch npm install command starting from your root project folder instead of outside of it, so the installation steps will only update the existing package-lock.json file instead of creating a new one.
Hope this helps.

Respondent: barbara

Solution #4:

Yes you should, As it locks the version of each and every package which you are using in your app and when you run npm install it install the exact same version in your node_modules folder. This is important becasue let say you are using bootstrap 3 in your application and if there is no package-lock.json file in your project then npm install will install bootstrap 4 which is the latest and you whole app ui will break due to version mismatch.

Respondent: Neha Sharma

Solution #5:

It should also be noted that one key detail about package-lock.json is that it cannot be published, and it will be ignored if found in any place other than the top level package. It shares a format with npm-shrinkwrap.json(5), which is essentially the same file, but allows publication. This is not recommended unless deploying a CLI tool or otherwise using the publication process for producing production packages.

If both package-lock.json and npm-shrinkwrap.json are present in the root of a package, package-lock.json will be completely ignored.

Respondent: Donald L Wilson

Solution #6:

Check for package-lock.json file at C:Windowssystem32.

If it doesn’t exist, run cmd as admin and execute the following commands:

npm config set package-lock false
npm install
Respondent: antorpramanik

Solution #7:

came out of this issue by changing the version in package.json file and also changing the name of the package and finally deleted the package-lock.json file

Respondent: Abhishek

Solution #8:

If this is output from a Dockerfile then you don’t want / need to commit it.

However you will want to tag the base image and any other contributing images / applications.


FROM node:12.18.1
Respondent: Snowcrash

Solution #9:

I had same issue and the solution was to rename name field in package.json (remove white spaces)
enter image description here

Respondent: Max Zavodniuk

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy