aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

Specifying a version to install requires newer dependencies than specified, which breaks on older systems

Open nabeards opened this issue 8 months ago • 6 comments

Checkboxes for prior research

Describe the bug

I have a legacy project that requires node version 14. I know this version is no longer officially supported, but this is actually an issue with just installation, not use. Installing the last version of the SDK that supports nodejs version 14 doesn't work due to dependency issues.

Install and resulting error: yarn add @aws-sdk/[email protected] error @aws-sdk/[email protected]: The engine "node" is incompatible with this module. Expected version ">=18.0.0". Got "14.18.1"

I installed that same version into another project using a later nodejs version, and found that multiple dependencies somehow force-require later versions (3.804). Below is the full module dependency tree. For example, you'll see that later versions of lower dependencies are being required, [email protected], [email protected], [email protected], etc. I would expect installing a specific version would work.

└─┬ @aws-sdk/[email protected]
  └─┬ @aws-sdk/[email protected]
    ├─┬ @aws-sdk/[email protected]
    │ └─┬ @aws-sdk/[email protected]
    │   ├─┬ @aws-crypto/[email protected]
    │   │ ├─┬ @aws-crypto/[email protected]
    │   │ │ └── @aws-sdk/[email protected] deduped
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-crypto/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ ├─┬ @aws-sdk/[email protected]
    │   │ │ └── @aws-sdk/[email protected] deduped
    │   │ ├─┬ @aws-sdk/[email protected]
    │   │ │ └── @aws-sdk/[email protected] deduped
    │   │ ├─┬ @aws-sdk/[email protected]
    │   │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ ├─┬ @aws-crypto/[email protected]
    │   │ │ │ │ ├─┬ @aws-crypto/[email protected]
    │   │ │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-crypto/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├── @aws-sdk/[email protected]
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ │ └─┬ @aws-sdk/[email protected]
    │   │ │ │   └── @aws-sdk/[email protected] deduped
    │   │ │ └── @aws-sdk/[email protected] deduped
    │   │ ├─┬ @aws-sdk/[email protected]
    │   │ │ └── @aws-sdk/[email protected] deduped
    │   │ ├─┬ @aws-sdk/[email protected]
    │   │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ ├─┬ @aws-sdk/[email protected]
    │   │ │ │ └── @aws-sdk/[email protected] deduped
    │   │ │ └── @aws-sdk/[email protected] deduped
    │   │ ├─┬ @aws-sdk/[email protected]
    │   │ │ └── @aws-sdk/[email protected] deduped
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├── @aws-sdk/[email protected]
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   ├─┬ @aws-sdk/[email protected]
    │   │ └── @aws-sdk/[email protected] deduped
    │   └─┬ @aws-sdk/[email protected]
    │     └── @aws-sdk/[email protected] deduped
    └─┬ @aws-sdk/[email protected]
      └─┬ @aws-sdk/[email protected]
        └─┬ @aws-sdk/[email protected]
          ├─┬ @aws-crypto/[email protected]
          │ ├─┬ @aws-crypto/[email protected]
          │ │ └── @aws-sdk/[email protected] deduped
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-crypto/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ ├─┬ @aws-sdk/[email protected]
          │ │ └── @aws-sdk/[email protected] deduped
          │ ├─┬ @aws-sdk/[email protected]
          │ │ └── @aws-sdk/[email protected] deduped
          │ ├─┬ @aws-sdk/[email protected]
          │ │ └── @aws-sdk/[email protected] deduped
          │ ├─┬ @aws-sdk/[email protected]
          │ │ └── @aws-sdk/[email protected] deduped
          │ ├─┬ @aws-sdk/[email protected]
          │ │ ├─┬ @aws-sdk/[email protected]
          │ │ │ └── @aws-sdk/[email protected] deduped
          │ │ ├─┬ @aws-sdk/[email protected]
          │ │ │ └── @aws-sdk/[email protected] deduped
          │ │ └── @aws-sdk/[email protected] deduped
          │ ├─┬ @aws-sdk/[email protected]
          │ │ └── @aws-sdk/[email protected] deduped
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├── @aws-sdk/[email protected]
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          ├─┬ @aws-sdk/[email protected]
          │ └── @aws-sdk/[email protected] deduped
          └─┬ @aws-sdk/[email protected]
            └── @aws-sdk/[email protected] deduped

Regression Issue

  • [ ] Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node v14.18.1

Reproduction Steps

nvm use 14
npm i yarn
yarn add @aws-sdk/[email protected]
error @aws-sdk/[email protected]: The engine "node" is incompatible with this module. Expected version ">=18.0.0". Got "14.18.1"

Observed Behavior

error @aws-sdk/[email protected]: The engine "node" is incompatible with this module. Expected version ">=18.0.0". Got "14.18.1"

Expected Behavior

Installing version 3.565 should successfully install with proper dependencies.

Possible Solution

No response

Additional Information/Context

No response

nabeards avatar May 06 '25 21:05 nabeards

Please update your node version as the JS SDK v3 has dropped support for Node.js 14.x on May 1, 2024. PR

zshzbh avatar May 06 '25 21:05 zshzbh

@zshzbh As already stated: "I have a legacy project that requires node version 14. I know this version is no longer officially supported, but this is actually an issue with just installation, not use. Installing the last version of the SDK that supports nodejs version 14 doesn't work due to dependency issues."

Running the same install with Node 18 still installs the later versions of the packages, so specifying the version number is broken on later versions of node as well. Here's the wrong version install from node 18:

└─┬ @aws-sdk/[email protected]
  ├─┬ @aws-crypto/[email protected]
  │ ├─┬ @aws-crypto/[email protected]
  │ │ └── @aws-sdk/[email protected]
  │ └── @aws-sdk/[email protected]
  ├─┬ @aws-crypto/[email protected]
  │ └── @aws-sdk/[email protected]
  ├─┬ @aws-crypto/[email protected]
  │ └── @aws-sdk/[email protected]
  └─┬ @aws-sdk/[email protected]
    ├─┬ @aws-crypto/[email protected]
    │ └── @aws-sdk/[email protected]
    └─┬ @aws-crypto/[email protected]
      └── @aws-sdk/[email protected]

nabeards avatar May 06 '25 22:05 nabeards

I think the one last try would be setting engine-strict=true .


If you insist to use Node 14, I just came up with a solution, it might be weird, but you can upgrade the node version to ">=18.0.0" and install the aws js sdk package, and use node version 14(I don't know if that's gonna work tho, if that's not working, it's not working, and we won't fix this because the support for Node.js 14.x has been dropped).

Still, I highly suggest to upgrade node version as node 14 has reached end of life in Feb 16, 2023 - https://nodejs.org/en/about/previous-releases


For node 18 installations -

Running the same install with Node 18 still installs the later versions of the packages, so specifying the version number is broken on later versions of node as well. Here's the wrong version install from node 18:


└─┬ @aws-sdk/[email protected]
  ├─┬ @aws-crypto/[email protected]
  │ ├─┬ @aws-crypto/[email protected]
  │ │ └── @aws-sdk/[email protected]
  │ └── @aws-sdk/[email protected]
  ├─┬ @aws-crypto/[email protected]
  │ └── @aws-sdk/[email protected]
  ├─┬ @aws-crypto/[email protected]
  │ └── @aws-sdk/[email protected]
  └─┬ @aws-sdk/[email protected]
    ├─┬ @aws-crypto/[email protected]
    │ └── @aws-sdk/[email protected]
    └─┬ @aws-crypto/[email protected]
      └── @aws-sdk/[email protected]

What error message did you see? Could you please post the error message here?

zshzbh avatar May 07 '25 23:05 zshzbh

@zshzbh thanks for the response.

engine-strict=true produces a similar error:

% npm i @aws-sdk/[email protected]      
npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for @aws-sdk/[email protected]: wanted: {"node":">=18.0.0"} (current: {"node":"14.18.1","npm":"6.14.15"})
npm ERR! notsup Not compatible with your version of node/npm: @aws-sdk/[email protected]
npm ERR! notsup Not compatible with your version of node/npm: @aws-sdk/[email protected]
npm ERR! notsup Required: {"node":">=18.0.0"}
npm ERR! notsup Actual:   {"npm":"6.14.15","node":"14.18.1"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/nabeards/.npm/_logs/2025-05-08T08_59_58_233Z-debug.log

Regarding upgrading: Legacy projects can't just be upgraded to the latest version of node for convenience sake. It would be a major undertaking to rewrite the software to work with a newer version.


Regarding the Node 18 installation: there isn't an error per se, but you can see that it is still installing the latest versions of the tooling even when requesting a specific version of the software. If I request installation of version 3.565, I expect all of the dependencies to match that version. Instead, [email protected] is still installed. This is the crux of the issue: if I want a specific version of the tooling, I should only get that version and not the latest dependencies.


The good news is that I think I found a solution. I had to manually install two packages with specific versions in order to get client-s3 to install, and I could not use yarn (so this is not a great solution since I'll have to do a lot of magic to get this to auto-install). But here's what I did nonetheless:

npm i @aws-sdk/[email protected]
npm i @aws-sdk/[email protected]
npm i @aws-sdk/[email protected]

As I said, the main issue is that requesting a specific version of client-s3 just doesn't work with dependencies. I would expect installing [email protected] would install only the matching dependencies of 3.565 (in other words, installed [email protected] and [email protected] for me). It currently just installs the latest dependencies instead, breaking everything.

Another solution would be that the package here was using proper semver instead, but I don't see that happening. (Completely removing support for a specific node version should have moved the major release version number up from 3 to 4.)

nabeards avatar May 08 '25 09:05 nabeards

Edit: I posted this without the latest comment from @nabeards having loaded, a workaround was found.


This is because the @aws-crypto/* packages use a range of @aws-sdk/types.

Please work around this by adding an override for the @aws-sdk/types package used by the crypto packages. Either include @aws-sdk/types@<=3.565.0 in dependencies, or set

  "overrides": {
    "@aws-sdk/types": "<=3.565.0"
  },
  "resolutions": {
    "@aws-sdk/types": "<=3.565.0"
  },

kuhe avatar May 08 '25 15:05 kuhe

@kuhe your overrides workaround only works in NPM versions greater than 8.3.0, which I think I could custom-install for NodeJS v14. I did try with the @aws-sdk/types@<=3.565.0, but it still didn't work for me on NodeJS v14 with npm v6 (attempts were still made when trying to install client-s3 to install [email protected]). I appreciate the suggestion though, and using npm 8.3 with the overrides may be a solution for auto-installing in the future.

nabeards avatar May 08 '25 15:05 nabeards

Hey @nabeards ,

Node.js 14.xeached end-of-life on April 30, 2023. I'm not surprised that it doesn't support it. Please upgrade to a Node.js LTS version, which is currently x22.17.0(LTS) as of today. - https://nodejs.org/en/download

zshzbh avatar Jul 11 '25 19:07 zshzbh

@zshzbh as already stated, that's not a viable solution for this legacy software. And, if your software requires a later version of node than when it launched, then this package completely fails at valid semver. I'm closing the issue as it's apparent AWS isn't concerned in any way with having this work properly.

Oh well, life goes on, and fortunately we have removed all dependence on AWS moving forward, which makes the entire team happy.

nabeards avatar Jul 14 '25 05:07 nabeards

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar Jul 14 '25 05:07 github-actions[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

github-actions[bot] avatar Jul 29 '25 00:07 github-actions[bot]