Neo4j-graphql-js: Error related to babel-runtime in a bare bones ne-4j-graphql-js project

Created on 10 Jun 2019  Â·  8Comments  Â·  Source: neo4j-graphql/neo4j-graphql-js

I had been trying to use neo4j-graphql-js to layer neo4j and graphql into an existing REST API Project. I was consistently getting an error TypeError: graphql_1.parse is not a function. I couldn't resolve it. I'm a novice so I decided to start a basic new project and build from the ground up.

However, I am getting the following error when I try to run the program. It seems related to makeAugmentedSchema as the error goes away when I comment out this part from the examples.

I can share all of the code but its pretty much straight from the examples. I am using Typescript and Nodemon so perhaps its related to this.

Any direction on how to resolve this or what parts of my project I should post the code for,

Error: Cannot find module 'babel-runtime/helpers/objectWithoutProperties'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._resolveFilename (/mnt/c/Users/micha/github/graphql-api/node_modules/tsconfig-paths/lib/register.js:75:40)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)    at require (internal/module.js:11:18)
    at Object.<anonymous> (/mnt/c/Users/micha/github/graphql-api/node_modules/neo4j-graphql-js/dist/index.js:8:33)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)    at tryModuleLoad (module.js:505:12)

Most helpful comment

In neo4j-driver Version 1.7.5 babel-runtime was replaced with @babel/runtime, which breaks neo4j-graphql-js "assumed" dependencies

If neo4j-graphql-js depends on babel-runtime, it should put that in the dependencies rather dev-dependencies

All 8 comments

Is your example project on Github or somewhere we can take a look at? If not, could you share the code around how you are calling makeAugmentedSchema?

Thanks for replying and apologies for my delayed response. I have cleared the project back to the bare bones starter example. My full code is available here:

https://github.com/infornite/graphql-api

I had to install babel-plugin-transform-runtime to get this to work.

Here's a snippet from my package.json

"dependencies": {
    "babel-plugin-transform-runtime": "^6.23.0",
    "graphql": "^14.3.1",
    "neo4j-driver": "^1.7.5",
    "neo4j-graphql-js": "^2.6.2",
    ....
  }

I think the babel-plugin-transform-runtime is related to neo4j-driver.

Can someone confirm that?

On 12. Jun 2019, at 16:48, Michele Memoli notifications@github.com wrote:

I had to install babel-plugin-transform-runtime to get this to work.

Here's a snippet from my package.json

"dependencies": {
"babel-plugin-transform-runtime": "^6.23.0",
"graphql": "^14.3.1",
"neo4j-driver": "^1.7.5",
"neo4j-graphql-js": "^2.6.2",
....
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Thanks @mmmoli I copied all of the dependencies from your note and its working for me now. Much appreciated.

In neo4j-driver Version 1.7.5 babel-runtime was replaced with @babel/runtime, which breaks neo4j-graphql-js "assumed" dependencies

If neo4j-graphql-js depends on babel-runtime, it should put that in the dependencies rather dev-dependencies

I have a demo repository, demonstrating this issue:
https://github.com/viktorstrate/neo4j-graphql-js-babel-7-issue

It's based on the GRAND stack starter, but I updated babel to v7, and now it won't build.

To reproduce, clone the repo and run:

$ yarn install
$ yarn start

Resulting output

The stack trace shows that the problem lies at neo4j-graphql-js/dist/index.js:8:33
Because babel-runtime was not found

$ yarn start
yarn run v1.16.0
$ ./node_modules/.bin/nodemon --exec babel-node src/index.js
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node src/index.js`
internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module 'babel-runtime/helpers/objectWithoutProperties'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/viktorstrate/Desktop/neo4j-graphql-js-babel-7-issue/node_modules/neo4j-graphql-js/dist/index.js:8:33)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Module._compile (/Users/viktorstrate/Desktop/neo4j-graphql-js-babel-7-issue/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Object.newLoader [as .js] (/Users/viktorstrate/Desktop/neo4j-graphql-js-babel-7-issue/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:598:32)
[nodemon] app crashed - waiting for file changes before starting...

@viktorstrate It's a bug.

yard add babel-plugin-transform-runtime will solve it.

Was this page helpful?
0 / 5 - 0 ratings