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

2

7

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

Abstergent answered 8/10, 2021 at 10:13 Comment(3)
did you try to remove the node_modules file and this package.lock.json file? Please do that and then again install "Npm install", that'd be solved.Sarazen
Yeah. I'm wondering if someone knows the reason.Abstergent
None of the answers are satisfactory yet. At work we've some shared packages, and after some clean install the package-lock.json files have been updated with this name despite the fact those shared packages have had the name property since the beginning. It's kind of odd.Madgemadhouse
C
1

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

Caoutchouc answered 24/2, 2022 at 22:23 Comment(1)
I have the same issue, but my project folder name and the name in the package.json are the samePrintable
C
0

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",
Casket answered 21/9, 2022 at 9:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.