neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

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

Open infornite opened this issue 5 years ago • 9 comments

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)

infornite avatar Jun 10 '19 06:06 infornite

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?

johnymontana avatar Jun 10 '19 17:06 johnymontana

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

infornite avatar Jun 12 '19 11:06 infornite

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",
    ....
  }

mmmoli avatar Jun 12 '19 14:06 mmmoli

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 [email protected] 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.

emregency avatar Jun 12 '19 16:06 emregency

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

infornite avatar Jun 13 '19 10:06 infornite

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

chumbalum avatar Jun 23 '19 12:06 chumbalum

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 avatar Jul 07 '19 21:07 viktorstrate

@viktorstrate It's a bug.

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

benjamin-rood avatar Jul 10 '19 09:07 benjamin-rood

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608

michaeldgraham avatar May 02 '21 04:05 michaeldgraham