Name under black package in package-lock.json keeps removing and adding automatically

Viewed 753

On npm install, I see that in package-lock.json property packages[""].name is sometimes removed and sometimes added. How to prevent this change, since it appears in git changes?

package-lock.json

2 Answers

I have experienced this behaviour that name is added when package.json has a name that is different from project root directory name.

projectdir/package.json with name="projectdir" => no name in package-lock.json

projectdir/package.json with name="anothername" => name="anothername" in package-lock.json

I had the same problem an found the solution to remove the package name in package.json file. So I remove this line:

"name": "My package name",
Related