npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm update doesn't always update development dependencies

What I Wanted to Do

I wanted to update a development dependency, and I expected it to be updated.

What Happened Instead


Reproduction Steps

$ git clone -b npm-up-dev-dep npm-up-dev-dep
$ cd npm-up-dev-dep

$ cat package.json
  "devDependencies": {
    "resolve": "^1.9.0"

$ npm i
# change version in package.json to ^1.10.0
$ npm up  # nothing happens
$ npm up --save-dev  # --save-dev makes it work

Link to the corresponding branch of a GitHub repository.


This happens when the current development package (on disk) doesn’t match the new version range. It gets filtered out, but is not added back, as it happens with production dependencies. That is, unless --save-dev was passed.

Platform Info

$ npm --versions
{ npm: '6.9.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.1',
  modules: '67',
  napi: '4',
  nghttp2: '1.36.0',
  node: '11.15.0',
  openssl: '1.1.1b',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.28.0',
  v8: '',
  zlib: '1.2.11' }

$ node -p process.platform