npm Community Forum (Archive)

The npm community forum has been discontinued.

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

package-lock.json and optional packages

Hi, this is a cross-post from https://github.com/npm/npm since the issue in question does not seem to have made its way here yet.

The issue is: https://github.com/npm/npm/issues/17722

To summarize, the way package-locking handles optional dependencies results in inconsistencies in the lock-file across different platforms, which adds unexpected churn and results in some dependencies not being locked if the lock-file was generated on the “wrong” platform.

Sorry for not following the reporting template, but everything is kind of already said in the original issue.


I would appreciate it if you did follow the reporting template. If that doesn’t get fixed, I’ll probably move this to #support, since the template is important for helping us sort through bugs quickly and we don’t really have time to respond to every #support issue ourselves (but the community does!)


@zkat this isn’t a #support ticket. It’s a genuine bug


There’s a reason the template is there. I’ll move this back when it follows the format.


@zkat I’ve filled in the changes here: package-lock.json keeps changing between platforms and runs