Skip to content

[BUG] npm install --production creates/leaves behind empty directories of some devDependencies #3975

Open
@rmuchall

Description

@rmuchall

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using the command npm install --production npm creates (and/or fails to remove during execution) empty directories for some devDependencies.

Expected Behavior

When using the command npm --production I expect npm to install only the packages listed in dependencies, omit the packages listed in devDependencies and not create/leave behind empty directories for any devDependency packages.

Steps To Reproduce

  1. Create a new directory with the following package.json:
{
  "name": "npm-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "dayjs": "^1.10.7"
  },
  "devDependencies": {
    "webpack-cli": "^4.9.1"
  }
}
  1. Execute the following command: npm install --production
  2. Note that npm has created (and/or not removed during execution) empty directories that correspond to some devDependencies. (See attached screenshot).

npm-bug-01

Environment

  • OS: Windows 10
  • Node: v16.13.0
  • npm: 8.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions