`npm ci` 6.12.1 does not remove `node_modules/.bin` directory or contents prior to install

What I Wanted to Do

Run npm ci i.e. with development dependencies

Run NODE_ENV=production npm ci i.e. without development dependencies

Expect to find node_modules/.bin non-existent or empty

What Happened Instead

Broken symlinks for devDependencies are left within node_modules/bin.

Reproduction Steps

Create package.json file with dependencies and devDependencies e.g.

{
  "dependencies": {
    "autolinker": "^1.8.3"
  },
  "devDependencies": {
    "intern": "^3.4.3"
  }
}

Within a terminal in the same location of the package.json file:

$ npm ci
$ ls node_modules
abbrev               buffer-to-vinyl     duplexer2             for-own            is-equal-shallow                       kind-of         optionator                 resolve           type-check
amdefine             chai                duplexify             fs-constants       isexe                                  lazystream      ordered-read-streams       safe-buffer       typedarray
ansi-regex           chalk               end-of-stream         get-stdin          is-extendable                          leadfoot        pako                       seek-bzip         type-detect
ansi-styles          charm               escape-string-regexp  glob               is-extglob                             levn            parse-glob                 semver            @types
argparse             clone               escodegen             glob-base          is-glob                                lodash          path-dirname               source-map        uglify-js
array-unique         clone-stats         esprima               glob-parent        is-gzip                                lodash-amd      path-is-absolute           sprintf-js        unique-stream
arr-diff             commander           estraverse            glob-stream        is-natural-number                      lodash.isequal  pend                       stat-mode         util-deprecate
arr-flatten          concat-map          esutils               graceful-fs        is-number                              math-random     pinkie                     stream-combiner2  uuid
assertion-error      concat-stream       expand-brackets       graceful-readlink  isobject                               merge-stream    pinkie-promise             stream-shift      vali-date
async                convert-source-map  expand-range          gulp-sourcemaps    is-posix-bracket                       micromatch      platform                   string_decoder    vinyl
autolinker           core-util-is        extend                handlebars         is-primitive                           mimetype        prelude-ls                 strip-ansi        vinyl-assign
balanced-match       decompress          extend-shallow        has-ansi           is-relative                            minimatch       preserve                   strip-bom         vinyl-fs
benchmark            decompress-tar      extglob               has-flag           is-stream                              minimist        process-nextick-args       strip-bom-stream  which
bl                   decompress-tarbz2   fast-levenshtein      inflight           istanbul                               mkdirp          randomatic                 strip-dirs        wordwrap
brace-expansion      decompress-targz    fd-slicer             inherits           is-tar                                 neo-async       readable-stream            sum-up            wrappy
braces               decompress-unzip    filename-regex        intern             is-utf8                                nopt            read-all-stream            supports-color    xtend
buffer-alloc         deep-eql            fileset               is-absolute        is-valid-glob                          normalize-path  regex-cache                tar-stream        yauzl
buffer-alloc-unsafe  deep-is             file-type             isarray            is-zip                                 object-assign   remove-trailing-separator  through2
buffer-crc32         diff                fill-range            is-buffer          json-stable-stringify-without-jsonify  object.omit     repeat-element             through2-filter
buffer-fill          digdug              first-chunk-stream    is-bzip2           js-yaml                                once            repeat-string              to-absolute-glob
buffer-from          dojo                for-in                is-dotfile         jszip                                  optimist        replace-ext                to-buffer
$ ls node_modules/.bin
digdugEnvironments  escodegen  esgenerate  esparse  esvalidate  handlebars  intern-client  intern-runner  istanbul  js-yaml  mkdirp  nopt  seek-bunzip  seek-table  semver  strip-dirs  uglifyjs  which
$ NODE_ENV=production npm ci
$ ls node_modules
autolinker
$ ls node_modules/.bin
digdugEnvironments  escodegen  esgenerate  esparse  esvalidate  handlebars  intern-client  intern-runner  istanbul  js-yaml  mkdirp  nopt  seek-bunzip  seek-table  semver  strip-dirs  uglifyjs  which

Details

Works as expected in v6.12.0

Platform Info

$ npm --versions
{ sos: '1.0.0',
  npm: '6.12.1',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '4',
  nghttp2: '1.39.2',
  node: '8.16.2',
  openssl: '1.0.2s',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.23.2',
  v8: '6.2.414.78',
  zlib: '1.2.11' }

$ node -p process.platform
linux

Notice: These forums have been archived