Skip to content

[BUG] npm ci fails with ERR_FS_EISDIR for node_modules/.bin #6051

Closed

Description

@justintoman

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

Can't npm ci if there's an existing .bin directory in node_modules

Expected Behavior

It deletes node_modules without crashing

Steps To Reproduce

Use this package.json

{
  "name": "npm-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "eslint": "^8.31.0"
  }
}
  • npm ci
  • npm ci
  • It fails the second time
npm ERR! code ERR_FS_EISDIR
npm ERR! syscall rm
npm ERR! path /Users/justintoman/code/npm-test/node_modules/.bin
npm ERR! errno 21
npm ERR! Path is a directory: rm returned EISDIR (is a directory) /Users/justintoman/code/npm-test/node_modules/.bin

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/justintoman/.npm/_logs/2023-01-12T21_14_19_211Z-debug-0.log

Environment

  • npm: 9.3.0
  • Node.js: 18.12.1
  • OS Name: MacOS Venture 13.1
  • System Model Name: Macbook Pro
  • npm config:
; node bin location = /Users/justintoman/.nvm/versions/node/v18.12.1/bin/node
; node version = v18.12.1
; npm local prefix = /Users/justintoman/code/npm-test
; npm version = 9.3.0
; cwd = /Users/justintoman/code/npm-test
; HOME = /Users/justintoman
; Run `npm config ls -l` to show all defaults.

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    Release 9.xwork is associated with a specific npm 9 release
    on Jan 12, 2023
  2. eleonoratennyson commented on Jan 13, 2023

    @eleonoratennyson
    Contributor

    👍 also having this issue when running npm ci on circleci with v9.3.0. 9.2.0 runs clean on the same machine

  3. eleonoratennyson commented on Jan 13, 2023

    @eleonoratennyson
    Contributor

    PR with a fix here #6052

  4. iSuslov commented on Jan 13, 2023

    @iSuslov

    +1 I'm surprised dev team doesn't have a test for it.

  5. jamesshaw1987 commented on Jan 13, 2023

    @jamesshaw1987
    Contributor

    +1 I'm surprised dev team doesn't have a test for it.

    Agreed. Added a PR (#6054) that adds a test to @burkel24's PR (#6052).

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

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions