realm/realm-graphql-service

Cannot run npm start with ROS

Closed this issue · 1 comments

I ran npm run build then npm pack producing realm-object-server-graphql-1.0.0.tgz. Then I ran ros init to create a server project. I then ran npm install realm-object-server-graphql-1.0.0.tgz in that project and updated the index.ts file to be:

import { BasicServer } from 'realm-object-server'
import * as path from 'path'
import { GraphQLService } from 'realm-object-server-graphql'

const server = new BasicServer()

server.addService(new GraphQLService())

server.start({
        // This is the location where ROS will store its runtime data
        dataPath: path.join(__dirname, '../data'),
    })
    .then(() => {
        console.log(`Realm Object Server was started on ${server.address}`)
    })
    .catch(err => {
        console.error(`Error starting Realm Object Server: ${err.message}`)
    })

This produces the following error after npm start:

Adam-Fishs-MacBook-Pro:graphqltest afish$ npm start

> my-ros-app@1.0.0 start /Users/afish/Documents/realm-object-server-graphql/test/graphqltest
> npm run build && node dist/index.js


> my-ros-app@1.0.0 build /Users/afish/Documents/realm-object-server-graphql/test/graphqltest
> rm -rf dist; ./node_modules/.bin/tsc

../../node_modules/@types/graphql/subscription/subscribe.d.ts(17,12): error TS2304: Cannot find name 'AsyncIterator'.
../../node_modules/@types/graphql/subscription/subscribe.d.ts(29,12): error TS2304: Cannot find name 'AsyncIterable'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-ros-app@1.0.0 build: `rm -rf dist; ./node_modules/.bin/tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the my-ros-app@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/afish/.npm/_logs/2017-12-08T01_29_06_448Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-ros-app@1.0.0 start: `npm run build && node dist/index.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the my-ros-app@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/afish/.npm/_logs/2017-12-08T01_29_06_469Z-debug.log

Which is described here: apollographql/graphql-subscriptions#83 (comment)

However, the solution seems to be to change the tsconfig.json but that seems odd if we are providing a library. How can we fix this for the user?