ERR_PACKAGE_PATH_NOT_EXPORTED
@jaydenseric  

 Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in D:\CRUD-APIS\original-issue\node_modules\graphql-upload\package.json

I'm new to Graphql. I am trying to upload a file using Graphql. I'm following the code written in the official doc of appollo but getting this error.


`const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');
const {
  GraphQLUpload,
  graphqlUploadExpress, // A Koa implementation is also exported.
} = require('graphql-upload');

// const GraphQLUpload = require("graphql-upload/GraphQLUpload.js");
// const graphqlUploadExpress= require("graphql-upload/graphqlUploadExpress.js");
const { finished } = require('stream/promises');
const { ApolloServerPluginLandingPageLocalDefault } = require('apollo-server-core');

const typeDefs = gql`

  scalar Upload

  type File {
    filename: String!
    mimetype: String!
    encoding: String!
  }

  type Query {

    otherFields: Boolean!
  }

  type Mutation {
    
    singleUpload(file: Upload!): File!
  }
`;

const resolvers = {

  Upload: GraphQLUpload,

  Mutation: {
    singleUpload: async (parent, { file }) => {
      const { createReadStream, filename, mimetype, encoding } = await file;

 
      const stream = createReadStream();


      const out = require('fs').createWriteStream('local-file-output.txt');
      stream.pipe(out);
      await finished(out);

      return { filename, mimetype, encoding };
    },
  },
};

async function startServer() {
  const server = new ApolloServer({
    typeDefs,
    resolvers,
    
    csrfPrevention: true,
    cache: 'bounded',
    plugins: [ApolloServerPluginLandingPageLocalDefault({ embed: true })],
  });
  await server.start();

  const app = express();

 
  app.use(graphqlUploadExpress());

  server.applyMiddleware({ app });

  await new Promise((r) => app.listen({ port: 4000 }, r));

  console.log(`🚀 Server ready at http://localhost:4000${server.graphqlPath}`);
}

startServer();`

