Skip to content

[BUG] Dev dependency should not throw “unsupported platform” error when using --production flag on npm install #2921

Open
@aral

Description

Current Behavior:

If you have a module that is not supported on your platform set in the devDependencies object in your package file and you do a production install using the --production flag, the installation fails with an “Unsupported platform” (EBADPLATFORM) error. Since the module should not be installed/used during a production install, it should also not throw an error or otherwise affect the outcome of the installation.

Expected Behavior:

A module that’s declared in devDependencies should not affect the outcome of a production install.

Steps To Reproduce:

  1. Create a module, M, that specifies an OS different to the one you’re currently on in its npm package file. e.g., if you’re on a Mac, specify:
  "os": [
    "win32"
  ]
  1. Create an app, A, that includes module M in its devDependencies. e.g.,
  "devDependencies": {
    "M": "1.0.0"
}
  1. Do a production install on app A:
npm install --production

Note that the installation fails because module M is not supported on your system, even though you’re doing a production build and module M should not be installed or used.

Environment:

  • OS (noticed/reproduced on): macOS Big Sur
  • Node: 14.16.0
  • npm: 7.6.3

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions