npm install --only=prod --verbose please do not pre fetch devDependencies

What I Wanted to Do

When is use npm install with --only=prod arguments, i just want npm only fetch module in dependencies.

What Happened Instead

it’s supposed to ONLY fetch the dependent module but it fetch all if npm version >= 5.10.0

Reproduction Steps

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "qqtea": "*"
  },
  "devDependencies": {
    "pm2": "*",
    "express": "*",
    "@babel/cli": "^7.2.3",
    "@babel/core": "^7.2.2",
    "@babel/plugin-proposal-class-properties": "^7.2.3",
    "@babel/plugin-transform-modules-commonjs": "^7.2.0",
    "@babel/preset-flow": "^7.0.0",
    "@skpm/babel-preset": "^0.2.1",
    "@skpm/sketchapp-json-plugin": "^0.2.0",
    "react": "^16.7.0",
    "react-native-web": "^0.10.0-alpha.2",
    "sketchapp-json-flow-types": "^0.3.4",
    "react-art": "^16.7.0",
    "react-dom": "^16.7.0",
    "react-sketchapp": "^2.1.2",
    "react-sketchapp-web": "^0.1.7",
    "react-test-renderer": "^16.7.0",
    "sketch-constants": "^1.1.0",
    "sketchapp-json-plugin": "^0.1.2"
  }
}

npm version >= 5.10.0

run npm install --only=prod --verbose you will see npm fetch all the module.

if you use npm version <= 5.8.0 , run the same command, you will see the different.

this bug make npm install in production mode very slow if i have a lot of module in devDependencies.

Details

I find which commit make this change.

BUG: https://github.com/npm/npm/commit/db846c2d57399f277829036f9d96cd767088097e

NOT BUG: https://github.com/npm/npm/commit/57fa338706ab122ab7e13d2206016289c5bdacf3

this commit (db846c2d57399f277829036f9d96cd767088097e) remove if condition and add all the dependencies to the steps, and make this bug.

Npm fetched all dependencies, include depDependencies.

npm install with --only=prod arguments only fetch the dependencies filed modules in package.json.

@zkat @iarna

about this commit, why change install.js line 461-475 ?

This change causes npm to ignore the command line parameters requesting all dependent modules.

Please pay attention to this issue!!!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.