Skip to content

[BUG] npm dedupe after npm update removes everything in package.json & package-lock.json and changes package name to "dedupe" #1693

Closed
@kokarn

Description

@kokarn

Current Behavior:

Empties everything except name from package.json & package-lock.json

$ npm dedupe
removed 1925 packages in 28s

package.json

{
  "name": "dedupe"
}

Expected Behavior:

Dedupe should dedupe, maybe with smaller changes?

Steps To Reproduce:

Pretty basic react app with the following package.json

{
  "name": "dedupe-test",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "got": "^11.5.1",
    "history": "^5.0.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^3.4.1",
    "victory": "^35.0.8"
  },
  "scripts": {
    "ci-test": "echo \"works\""
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "husky": "^4.2.5"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run ci-test",
      "pre-push": "npm run ci-test"
    }
  }
}
  1. npm install
  2. npm update
  3. npm dedupe

Environment:

  • OS: macOS 10.15.6
  • Node: 14.7.0
  • NPM: 7 beta 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions