yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

--production flag ineffective, installs devDependencies #5122

Closed heisian closed 6 years ago

heisian commented 6 years ago
$ yarn --version
1.3.2

BUG

What is the current behavior? yarn installs devDependencies within package.json when using the --production flag.

If the current behavior is a bug, please provide the steps to reproduce.

/tmp # cat package.json 
{
  "devDependencies": {
    "@storybook/react": "^3.2.12",
    "autoprefixer": "^6.5.0",
    "babel-cli": "^6.24.1",
    "babel-core": "^6.13.2",
    "babel-eslint": "^6.1.2",
    "babel-loader": "^7.0",
    "babel-plugin-transform-object-assign": "^6.8.0",
    "babel-plugin-transform-react-constant-elements": "^6.9.1",
    "card-validator": "^4.1.0",
    "case-sensitive-paths-webpack-plugin": "^1.1.3",
    "clean-webpack-plugin": "^0.1.10",
    "compression-webpack-plugin": "^1.0.0",
    "cookies-js": "^1.2.3",
    "credit-card-type": "^5.0.2",
    "css-loader": "^0.28",
    "deepmerge": "^1.5.0",
    "downloadjs": "^1.4.7",
    "elasticsearch": "^13.3.1",
    "eslint": "^3.3.0",
    "eslint-config-airbnb": "^10.0.1",
    "eslint-import-resolver-babel-module": "^3.0.0",
    "eslint-plugin-babel": "^4.1.2",
    "eslint-plugin-import": "^1.13.0",
    "eslint-plugin-jsx-a11y": "^2.1.0",
    "eslint-plugin-react": "^6.0.0",
    "extract-text-webpack-plugin": "^2.1.2",
    "favicons-webpack-plugin": "^0.0.7",
    "file-loader": "^0.11.1",
    "form-data": "^2.3.1",
    "fs-extra": "^0.30.0",
    "html-webpack-plugin": "^2.30.1",
    "img-loader": "^2.0.0",
    "imports-loader": "^0.7.1",
    "inline-manifest-webpack-plugin": "^3.0.1",
    "inquirer": "^3.3.0",
    "json2csv": "^3.11.5",
    "koa-webpack": "^0.6.0",
    "koa-connect-history-api-fallback": "^0.3.1",
    "koa-convert": "^1.2.0",
    "koa-static": "^3.0.0",
    "load-google-maps-api": "^1.0.0",
    "madge": "^1.4.3",
    "mobile-detect": "^1.3.3",
    "node-sass": "^4.0.0",
    "nodemon": "1.14.x",
    "nyc": "11.2.x",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "postcss-loader": "^2.0.5",
    "prop-types": "^15.5.10",
    "qs": "^6.4.0",
    "raw-body": "^2.3.0",
    "rc-progress": "^2.2.2",
    "rc-slider": "^5.1.3",
    "react": "^15.6.1",
    "react-async-script": "^0.9.1",
    "react-autosuggest": "^8.0.1",
    "react-burger-menu": "^2.1.11",
    "react-countup": "^1.3.0",
    "react-dom": "^15.6.1",
    "react-fa": "^4.1.2",
    "react-geosuggest": "^2.3.6",
    "react-google-recaptcha": "^0.9.7",
    "react-hammerjs": "wlingke/react-hammerjs",
    "react-helmet": "^5.2.0",
    "react-modal": "^2.3.2",
    "react-redux": "^4.4.5",
    "react-router-dom": "^4.2.2",
    "react-scroll": "^1.4.4",
    "react-select": "^1.0.0-rc.5",
    "react-text-mask": "^2.0.0",
    "redux": "^3.0.0",
    "redux-form": "^7.0.3",
    "redux-thunk": "^2.1.0",
    "resolve-url-loader": "^2.0.2",
    "sass-lint": "^1.11.1",
    "sass-loader": "^6.0.5",
    "sass-mq": "^3.2.9",
    "set-cookie-parser": "^1.0.2",
    "source-map-url": "^0.4.0",
    "static-site-generator-webpack-plugin": "^3.4.1",
    "style-loader": "^0.17.0",
    "text-mask-addons": "^3.6.0",
    "tree-model": "^1.0.6",
    "url-loader": "^0.5.9",
    "webpack": "^2.7.0",
    "webpack-merge": "^4.1.1",
    "xlsx": "^0.11.12"
  },
  "optionalDependencies": {
    "babel-plugin-module-resolver": "^2.5.0",
    "babel-plugin-transform-async-to-generator": "^6.8.0",
    "babel-plugin-transform-class-properties": "^6.11.5",
    "babel-plugin-transform-export-extensions": "^6.8.0",
    "babel-plugin-transform-object-rest-spread": "^6.8.0",
    "babel-polyfill": "^6.23.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.11.1",
    "babel-register": "^6.26.0",
    "babel-runtime": "^6.23.0",
    "chai": "^3.5.0",
    "dotenv": "^4.0.0"
  },
  "dependencies": {
    "analytics-node": "^3.0.0",
    "aws-sdk": "^2.105.0",
    "axios": "^0.16.1",
    "bcryptjs": "^2.4.3",
    "busboy": "^0.2.14",
    "cookie": "^0.3.1",
    "docusign-esign": "^3.2.0",
    "ioredis": "^3.1.4",
    "jsonwebtoken": "^7.4.3",
    "jszip": "^3.1.4",
    "kcors": "^2.2.0",
    "koa": "^2.0.0-alpha.7",
    "koa-bodyparser": "^3.2.0",
    "koa-compress": "^2.0.0",
    "koa-context-validator": "^0.2.0",
    "koa-mount": "^2.0.0",
    "koa-passport": "^3.0.0-rc.1",
    "koa-ratelimit": "^4.0.0",
    "koa-router": "^7.0.1",
    "koa-xml-body": "^2.0.0",
    "moment": "^2.14.1",
    "mongoose": "4.11.8",
    "neverbounce": "^0.2.7",
    "node-schedule": "^1.2.5",
    "object-path": "^0.11.4",
    "passport-jwt": "^2.1.0",
    "passport-local": "^1.0.0",
    "shortid": "^2.2.6",
    "validator": "^5.5.0",
    "winston": "^2.3.1",
    "winston-papertrail": "^1.0.5",
    "xml2js": "^0.4.18"
  }
}

/tmp # yarn install --production
yarn install v1.3.2
warning package.json: No license field
info No lockfile found.
warning No license field
[1/4] Resolving packages...
warning img-loader > imagemin-mozjpeg > mozjpeg > bin-build > download > gulp-decompress > gulp-util@3.0.8: Use individual modules instead of a grab-bag
error Couldn't find the binary git
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
/tmp # 

img-loader is in devDependencies and since the binary is not available, yarn fails out.

What is the expected behavior? Do not install devDependencies with the --production flag.

Please mention your node.js, yarn and operating system version. node v8.2.1, Alpine Linux 3.7

heisian commented 6 years ago

2304

2703

rally25rs commented 6 years ago

Duplicate of #3630

Yarn does not install the devDeps, but it does need to resolve them to determine hoisting and create a deterministic install. There is discussion in the above issue.