[BUG] Dev dependency should not throw “unsupported platform” error when using --production flag on npm install
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
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:
- 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"
]
- Create an app, A, that includes module M in its
devDependencies. e.g.,
"devDependencies": {
"M": "1.0.0"
}
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the package setup described and npm install --production on an unsupported dev dependency. Trace npm's production dependency resolution and platform validation; done means the dev dependency no longer affects the production install outcome and the reproduction completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100