Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

package-lock changes depending upon name of project folder #2770

Closed
robross0606 opened this issue Feb 24, 2021 · 4 comments
Closed

package-lock changes depending upon name of project folder #2770

robross0606 opened this issue Feb 24, 2021 · 4 comments
Labels
Bug thing that needs fixing Duplicate duplicate of another, existing issue Release 7.x work is associated with a specific npm 7 release

Comments

@robross0606
Copy link

robross0606 commented Feb 24, 2021

Current Behavior:

When using npm@7, if the folder name in which the project is being built matches the name of the project in package.json, a name property is actively removed (or never set) from package-lock.json.

If the project folder does not match the name in package.json then the property is actively set.

d219a7b5-b720-4017-9ab9-8c527b1e52b5

This is a change controlled file by definition. At the very least, this can cause thrashing of package-lock.json if multiple developers are working on the same project and their working copies are in different folders.

Expected Behavior:

The folder in which a project is checked out on the local file system should have zero bearing on the content of package-lock.json.

Steps To Reproduce:

  1. Check out a project into a folder with a name that matches the name of the package.
  2. Do an npm install
  3. Check the content of package-lock.json and confirm that odd name property does not exist.
  4. Rename the project folder to something that does not match the name of the package.
  5. Do an npm install
  6. Note that `package-lock.json" changes.
  7. Open package-lock.json and confirm that odd name property does exist.

Environment:

@robross0606 robross0606 added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Feb 24, 2021
@robross0606
Copy link
Author

Also note that this looks super odd and brings up all sorts of questions:

  "packages": {​​​​​​
    "": {​​​​​​  <------------------------------------------ ???
      "version": "1.2.0-dev",
      "license": "UNLICENSED",
      "dependencies": {​​​​​​
  • Why is package-lock.json listing the package itself under it's own "packages"?
  • Is it valid JSON to have an object property key be empty?

@ljharb
Copy link
Contributor

ljharb commented Feb 24, 2021

Yes, it's perfectly valid JSON.

@mirka
Copy link

mirka commented Feb 26, 2021

Duplicate of #2264?

@darcyclarke
Copy link
Contributor

Closing - Duplicate

@darcyclarke darcyclarke added the Duplicate duplicate of another, existing issue label Apr 9, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug thing that needs fixing Duplicate duplicate of another, existing issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

4 participants