1

I am trying to create a GraphQLServer using node.js. below is my server.js file but when i run "node server.js" command then it's showing "Cannot use import statement outside a module"

import { GraphQLServer } from 'graphql-yoga';
import schema from './schema';
const server = new GraphQLServer({ schema });

some articles suggested to use <script type="module"></script> but not working in my case.

i have installed following npm commands:-

1.Npm init -y
2.npm add graphql-yoga
3.npm install graphql-tools lodash.merge
Arvind Kumar
  • 259
  • 4
  • 15

0 Answers0