Skip to content

[BUG] npm ci --dry-run deletes node_modules folders #7239

Description

@starsparrow

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm ci --dry-run deletes node_modules contents.

Expected Behavior

Using the --dry-run flag should not delete the contents of node_modules.

Context: See issue #2524 which was closed by @darcyclarke due to it not being able to be replicated in npm 7. However, it has not been reopened despite someone commenting over a year ago that it was still an issue in 9.2.0. It is still an issue for me in 10.4.0, so I am creating an issue for the current version to get eyes on it again.

Steps To Reproduce

  1. npm init -y
  2. npm install redis (or whatever)
  3. npm ci --dry-run
  4. ls -la node_modules
    (I would expect the output of step 4 to still list the packages installed in step 2)

Environment

  • npm: 10.4.0
  • Node.js: 20.10.0
  • OS Name: Windows 10 (but using node/npm in Ubuntu 22.04 in WSL)
  • System Model Name: Microsoft Surface Laptop 3
  • npm config:
; node bin location = /home/me/.nvm/versions/node/v20.10.0/bin/node
; node version = v20.10.0
; npm local prefix = /home/me/code/npmtest
; npm version = 10.4.0
; cwd = /home/me/code/npmtest
; HOME = /home/me

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions