apollographql / meteor-integration

🚀 meteor add apollo
http://dev.apollodata.com/core/meteor.html
108 stars 45 forks source link

Error apollo-server-express in existing MeteorJS application. #135

Open LaurenceM10 opened 5 years ago

LaurenceM10 commented 5 years ago

I'm trying to add apollo-server-express to my Meteor application. I am following the documentation: https://www.apollographql.com/docs/react/recipes/meteor#Server using meteor add apollo

SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (node_modules/apollo-server-core/dist/index.js:10:22)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (node_modules/apollo-server-express/dist/index.js:6:28)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Module.require (module.js:353:17)
        at require (internal/module.js:12:17)
        at npmRequire (.meteor/local/build/programs/server/npm-require.js:133:10)
        at Module.useNode (packages/modules-runtime.js:687:18)
        at fileEvaluate (packages/modules-runtime.js:332:20)
        at require (packages/modules-runtime.js:228:16)
        at meteorInstall.imports.startup.server.apolloServer.js (imports/startup/server/apolloServer.js:1:35)
        at fileEvaluate (packages/modules-runtime.js:333:9)
        at require (packages/modules-runtime.js:228:16)
        at meteorInstall.imports.startup.server.index.js (imports/startup/server/index.js:1:127)
        at fileEvaluate (packages/modules-runtime.js:333:9)
        at require (packages/modules-runtime.js:228:16)
        at meteorInstall.server.main.js (server/main.js:1:14)
        at fileEvaluate (packages/modules-runtime.js:333:9)
        at require (packages/modules-runtime.js:228:16)
        at .meteor/local/build/programs/server/app/app.js:10551:1
        at .meteor/local/build/programs/server/boot.js:339:34
        at Array.forEach (native)
        at Function._.each._.forEach (/Users/macbookpro/.meteor/packages/meteor-tool/.1.5.2_2.cfilka.gl9bf++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
        at .meteor/local/build/programs/server/boot.js:158:5
        at .meteor/local/build/programs/server/boot.js:388:5
        at Function.run (.meteor/local/build/programs/server/profile.js:510:12)
        at .meteor/local/build/programs/server/boot.js:387:11
        Exited with code: 1
        Your application is crashing. Waiting for file change.
lorensr commented 5 years ago

I'm not sure what that error is, sorry! If you wanted to reproduce in a fork of this repo, I'd take a look: https://github.com/lorensr/test-meteor-apollo

LaurenceM10 commented 5 years ago

It's okay, I'll fork. But the error basically occurs when importing the apollo server to the /imports/startup/server/index.js file, which in turn is imported from server/main.js I made sure to have all the dependencies installed.

LaurenceM10 commented 5 years ago

@lorensr https://github.com/LaurenceM10/test-meteor-apollo/ I added the changes in server/server.js and it works but in my project it does not. The project I want to add apollo-server to is an existing meteor project, but I do not think that is the problem.

The versions of my dependencies are the following:

"apollo-boost": "^0.3.1", "apollo-server-express": "^2.0.0"

and my meteor version METEOR@1.5.2.2

LaurenceM10 commented 5 years ago

I also tried with:

"apollo-server-express": "^2.4.8"