graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

Problem to start a Apollo Server with GraphQL in version 16

Open Alexis798 opened this issue 2 years ago • 3 comments

I am working with node and I have found an issue with this version:

"graphql": "^16.7.1", "@apollo/server": "^4.7.5"

When I run the command "npm run dev" the server shows the next message.

USERFOLDER/node_modules/@graphql-tools/utils/esm/helpers.js:1 import { parse } from 'graphql'; ^^^^^ SyntaxError: Named export 'parse' not found. The requested module 'graphql' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:

import pkg from 'graphql'; const { parse } = pkg;

at ModuleJob._instantiate (internal/modules/esm/module_job.js:104:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:149:5)
at async Loader.import (internal/modules/esm/loader.js:166:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)

I solved it with the version ^15.8.0 of graphql, the message does not appear with that version, but I would like to know if that messages appears for some issue with the last version or is there a thing that I should change with my configuration to run the server with the last version of graphql.

Thank you

Alexis798 avatar Jul 07 '23 03:07 Alexis798

@IvanGoncharov @hwillson can maybe help on this one?

saihaj avatar Jul 07 '23 10:07 saihaj

@Alexis798 would you mind re-opening this issue over in https://github.com/apollographql/apollo-server? Thanks!

hwillson avatar Jul 10 '23 11:07 hwillson

Ok, if there I find something I will post it here too.

Alexis798 avatar Jul 12 '23 01:07 Alexis798

Closing this for now, as it seems to be an issue related to a specific downstream package.

yaacovCR avatar Mar 29 '24 07:03 yaacovCR