Possible to use only one package version using pnpm?

Possible to use only one package version using pnpm?


1

I need to use apollo-server and graphql-upload to handle file uploads. This is working as expected with the old graphql-upload v9. Updating to the latest v11 results in failing uploads. To make it short, the problem is, that apollo-server (and @nestjs/graphql) are depending on the old graphql-upload v8. (For those, who are interested in more) To get everything working, there should only be one version (v11) in my project.

I’m using pnpm. Listing which packages are using graphql-upload I get following:

@nestjs/graphql 7.9.1
├─┬ @apollo/gateway 0.17.0
│ └─┬ apollo-server-core 2.19.0
│   └── graphql-upload 8.1.0      // <--
├─┬ apollo-server-core 2.16.1
│ └── graphql-upload 8.1.0        // <--
└─┬ apollo-server-testing 2.19.0
  └─┬ apollo-server-core 2.19.0
    └── graphql-upload 8.1.0      // <--
apollo-server 2.19.0
├─┬ apollo-server-core 2.19.0
│ └── graphql-upload 8.1.0        // <--
└─┬ apollo-server-express 2.19.0
  └─┬ apollo-server-core 2.19.0
    └── graphql-upload 8.1.0      // <--
graphql-upload 9.0.0              // <-- only working if <v10

1 Answer
1


2

You may use pnpm overrides. In your case, you would add this to your package.json:

{
  "pnpm": {
    "overrides": {
      "graphql-upload": "11"
    }
  }
}

After adding or changing these overrides, just run pnpm install and pnpm will update your node_modules accordingly.

2

  • That link is broken.

    – Alper

    yesterday

  • fixed. The domain changed to pnpm.io from pnpm.js.org

    – Zoltan Kochan

    1 hour ago



Leave a Reply

Your email address will not be published. Required fields are marked *