Q:

How to get npm 5 to update lock file after adding new save-dev dependency?

When running npm install redux-observable --save-dev with npm 5.0.3 in an existing project with an existing package.json, the lock file gets updated with the newly installed package (redux-observable in this case), but not any existing packages in the package.json. Running npm install to try and refresh or regenerate the lock file doesn't work.

A:

This is a known bug in npm 5.0.x:
https://github.com/npm/npm/issues/16893
To work around this issue, you must run npm install with no arguments in a freshly cloned/created repository before doing npm install --save-dev package-name. If you get the ordering wrong, you'll need to delete the lock file and then re-run npm install in order to get npm to add entries for the existing package.json to the lock file.

