npm/cli

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

justintoman opened this issue ยท 4 comments

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.

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

PR with a fix here #6052

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

+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).