aws4-axios icon indicating copy to clipboard operation
aws4-axios copied to clipboard

AWS SAM build generating too big size in node_modules

Open Sheryorov opened this issue 3 years ago • 1 comments

Package.json:

{
  "name": "some lambda,
  "version": "1.0.0",
  "description": "some lambda",
  "main": "index.js",
  "repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs",
  "author": "SAM CLI",
  "license": "MIT",
  "dependencies": {
    "@babel/cli": "^7.8.4",
    "@babel/core": "^7.9.0",
    "@babel/preset-env": "^7.9.0",
    "@babel/register": "^7.10.1",
    "@babel/runtime": "^7.9.2",
    "@commercetools/api-request-builder": "^5.4.3",
    "@commercetools/sdk-auth": "^3.0.6",
    "@commercetools/sdk-client": "^2.1.2",
    "@commercetools/sdk-middleware-auth": "^6.1.2",
    "@commercetools/sdk-middleware-http": "^6.0.6",
    "@commercetools/sdk-middleware-logger": "^2.1.1",
    "@sentry/serverless": "^5.27.3",
    "async-disk-cache": "^2.0.0",
    "aws-sdk": "^2.648.0",
    "aws-xray-sdk-core": "^3.2.0",
    "aws4-axios": "^2.3.1",
    "awscred": "^1.5.0",
    "axios": "^0.21.1",
    "babel-plugin-transform-html-import-to-string": "0.0.1",
    "dinero.js": "^1.8.1",
    "handlebars": "^4.7.3",
    "i18n-iso-countries": "^5.1.0",
    "i18next": "^19.3.4",
    "i18next-node-fs-backend": "^2.1.3",
    "lambda-tester": "^4.0.1",
    "loglevel": "^1.6.7",
    "moment": "^2.26.0",
    "node-fetch": "^2.6.1",
    "rimraf": "^3.0.2",
    "wkhtmltopdf": "^0.3.4"
  },
  "babel": {
    "presets": [
      "@babel/preset-env"
    ],
    "plugins": [
      [
        "@babel/plugin-transform-runtime",
        {
          "regenerator": true
        }
      ],
      [
        "transform-html-import-to-string"
      ]
    ]
  },
  "devDependencies": {
    "@babel/cli": "^7.8.4",
    "@babel/core": "^7.9.0",
    "@babel/plugin-transform-runtime": "^7.9.0",
    "@babel/preset-env": "^7.9.5",
    "babel-eslint": "^10.1.0",
    "chai": "^4.2.0",
    "eslint": "^6.8.0",
    "eslint-config-blueimp": "^1.9.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-babel": "^5.3.0",
    "eslint-plugin-prettier": "^3.1.3",
    "mocha": "^6.1.4",
    "prettier": "^2.0.5"
  }
}

Apparent size: 262,9 MiB after npm i -q --no-audit --no-save --production --unsafe-perm. I guess somehow aws4-axios installing react-native dependencies.

npm why react-native
[email protected] peer
node_modules/react-native
  peer react-native@">=0.62.0-rc.0 <0.64.0" from @react-native-community/[email protected]
  node_modules/@react-native-community/cli
    @react-native-community/cli@"^4.10.0" from [email protected]
  peer react-native@">=0.56" from [email protected]
  node_modules/react-native-get-random-values
    react-native-get-random-values@"^1.4.0" from @aws-sdk/[email protected]
    node_modules/@aws-sdk/middleware-retry
      @aws-sdk/middleware-retry@"3.8.0" from @aws-sdk/[email protected]
      node_modules/@aws-sdk/client-sso
        @aws-sdk/client-sso@"3.8.0" from @aws-sdk/[email protected]
        node_modules/@aws-sdk/credential-provider-sso
          @aws-sdk/credential-provider-sso@"3.8.0" from @aws-sdk/[email protected]
          node_modules/@aws-sdk/credential-provider-node
            @aws-sdk/credential-provider-node@"3.8.0" from @aws-sdk/[email protected]
            node_modules/@aws-sdk/client-sts
              @aws-sdk/client-sts@"^3.4.1" from [email protected]
              node_modules/aws4-axios
                aws4-axios@"^2.3.1" from the root project
      @aws-sdk/middleware-retry@"3.8.0" from @aws-sdk/[email protected]
      node_modules/@aws-sdk/client-sts
        @aws-sdk/client-sts@"^3.4.1" from [email protected]
        node_modules/aws4-axios
          aws4-axios@"^2.3.1" from the root project

Sheryorov avatar Mar 12 '21 07:03 Sheryorov

Hey @Sheryorov, thanks for reporting this.

What version of npm are you using?

Since v7, it will now install peer dependencies automatically: https://github.blog/2021-02-02-npm-7-is-now-generally-available/

You can disable this behavior by passing --legacy-peer-deps.

jamesmbourne avatar Mar 15 '21 21:03 jamesmbourne