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

Jsonnode.jsGitExpress

Json Problem Overview


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?

Json Solutions


Solution 1 - Json

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.

Solution 2 - Json

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"}

Solution 3 - Json

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.

Solution 4 - Json

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.

Solution 5 - Json

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.

Solution 6 - Json

Check for package-lock.json file at C:\Windows\system32.

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

Set EXPO_DEBUG=true
npm config set package-lock false
npm install

Solution 7 - Json

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

Solution 8 - Json

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.

E.g.

FROM node:12.18.1

Solution 9 - Json

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

Solution 10 - Json

Simply follow below steps to overcome this issue.

  1. copy and paste package.json and package-lock.json from some other project, later on you can change/delete the dependencies which you won't require in your project.
  2. now run npm install command.

Voilla!!, you got it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVenkateshreddy PalaView Question on Stackoverflow
Solution 1 - JsonzoecarverView Answer on Stackoverflow
Solution 2 - JsonRahul MankarView Answer on Stackoverflow
Solution 3 - JsonNeha SharmaView Answer on Stackoverflow
Solution 4 - JsonDonald L WilsonView Answer on Stackoverflow
Solution 5 - JsonbarbaraView Answer on Stackoverflow
Solution 6 - JsonantorpramanikView Answer on Stackoverflow
Solution 7 - JsonAbhishekView Answer on Stackoverflow
Solution 8 - JsonSnowcrashView Answer on Stackoverflow
Solution 9 - JsonMax ZavodniukView Answer on Stackoverflow
Solution 10 - JsonRahul DakshView Answer on Stackoverflow