Hi, I’m following the Odyssey GraphQL Lift-off Tutorial I: Getting Started and in Lesson 5, Apollo Server, I’m having a problem. I followed the instructions and when I run the npm run start command I get a terminal error. I checked that when I run the command to be in the server folder, then, in order not to have typos I copied every line of code from the lesson, to the point where I have to run the command in the terminal. When I run npm run start I get the following error:
catstronauts-server-complete@1.0.0 start
nodemon src/index
[nodemon] 2.0.6
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node src/index.js
C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\lexer.js:420
throw (0, _syntaxError.syntaxError)(
^
GraphQLError: Syntax Error: Unexpected character: “;”.
at syntaxError (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\error\syntaxError.js:15:10)
at readNextToken (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\lexer.js:420:40)
at Lexer.lookahead (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\lexer.js:84:29)
at Lexer.advance (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\lexer.js:67:38)
at Parser.expectToken (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\parser.js:1408:19)
at Parser.parseName (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\parser.js:107:24)
at Parser.parseNamedType (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\parser.js:716:18)
at Parser.parseTypeReference (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\parser.js:697:19)
at Parser.parseFieldDefinition (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\parser.js:848:23)
at Parser.optionalMany (C:\Users\Ionut\Desktop\programare\Learn GraphQl\odyssey-lift-off-part1\server\node_modules\graphql\language\parser.js:1510:28) {
path: undefined,
locations: [ { line: 15, column: 22 } ],
extensions: [Object: null prototype] {}
}
[nodemon] app crashed - waiting for file changes before starting…
My code:
const { ApolloServer } = require(‘apollo-server’);
const typeDefs = require(‘./schema’);
const server = new ApolloServer({ typeDefs });
server.listen().then(() => {
console.log(`
🚀 Server is running!
🔉 Listening on port 4000
📭 Query at https://studio.apollographql.com/dev
`);
});