Git Product home page Git Product logo

Comments (15)

pmahmud avatar pmahmud commented on August 27, 2024 1

@AArmanD, @sayden is the author. I am guessing that is not related. Your error log says it cannot find babel-node at your machine. Meaning maybe the path is wrong or it was not installed properly. It's a bit weird error I would say, but you could try installing babel globally and/or separately:

  • npm install babel-cli -g
  • npm install --save-dev babel-cli
  • Also see here

from graphql-mongodb-example.

sayden avatar sayden commented on August 27, 2024

Sorry for the delay, I have tried few installation in few Linux distribution and it works perfectly. Maybe it's a Mac issue.

npm install
[...]
[email protected] node_modules/babel-relay-plugin
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
 mcastro@mariocastro  /tmp/graphql-mongodb-example   master  npm run populate

> [email protected] populate /tmp/graphql-mongodb-example
> node_modules/babel/bin/babel-node.js scripts/populationScript.es6

576a71e48d3152984f31d8a3
 mcastro@mariocastro  /tmp/graphql-mongodb-example   master  npm start

> [email protected] start /tmp/graphql-mongodb-example
> node_modules/babel/bin/babel-node.js server.es6

Server listening at 9000

from graphql-mongodb-example.

 avatar commented on August 27, 2024

@sayden What did you do to fix this? I'm having the same issue.

from graphql-mongodb-example.

sayden avatar sayden commented on August 27, 2024

@Sburke0708 actually I mentioned that I don't have this issue, maybe it's because I'm not using a Mac computer and I don't have any to try

from graphql-mongodb-example.

Jaikant avatar Jaikant commented on August 27, 2024

It worked seamlessly for me on a mac.

from graphql-mongodb-example.

pmahmud avatar pmahmud commented on August 27, 2024

@AArmanD After running npm install, try running the following:
To populate:
> node .\node_modules\babel\bin\babel-node.js .\scripts\populationScript.es6
To run the server:
> node .\node_modules\babel\bin\babel-node.js .\server.es6

from graphql-mongodb-example.

idkjs avatar idkjs commented on August 27, 2024

@pmahmud Thanks. Started over. ran npm install. Then tried your populate script. Output below. I tried re-running with your read me instruction, got same error. So looks like its not being read, maybe? Tried to see if the .es6 extension is being read in babel-node but could not confirm. I am thinking that is it.

klik:graphql-mongodb-example klik$ node .\node_modules\babel\bin\babel-node.js .\scripts\populationScript.es6
module.js:442
    throw err;
    ^

Error: Cannot find module '/Users/klik/Projects/graphql-mongodb-example/.node_modulesbabelbinbabel-node.js'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:456:3
klik:graphql-mongodb-example klik$ node ./node_modules/babel/bin/babel-node.js ./scripts/populationScript.es6
/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126
      if (!option) this.log.error("Unknown option: " + alias + "." + key, ReferenceError);
                           ^

TypeError: Cannot read property 'error' of undefined
    at OptionManager.mergeOptions (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:28)
    at OptionManager.addConfig (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
    at OptionManager.findConfigs (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
    at OptionManager.init (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
    at compile (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/api/register/node.js:117:22)
    at normalLoader (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/api/register/node.js:199:14)
    at Object.require.extensions.(anonymous function) [as .es6] (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/api/register/node.js:216:7)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)

from graphql-mongodb-example.

pmahmud avatar pmahmud commented on August 27, 2024

@AArmanD , it seems you are using unix, in that case try replacing the backslashes with slash like this:
> node ./node_modules/babel/bin/babel-node.js ./scripts/populationScript.es6
This assumes that you are in the graphql-mongodb-example folder and already ran npm install command and have babel-node.js inside the path: 'node_modules/babel/bin/'.
If you look closely at the error line:
Error: Cannot find module '/Users/klik/Projects/graphql-mongodb-example/.node_modulesbabelbinbabel-node.js'
This is not a valid path and I assume backslashes are the problem here:
/.node_modulesbabelbinbabel-node.js

from graphql-mongodb-example.

idkjs avatar idkjs commented on August 27, 2024

using mac, el capitan. If you look above \ failed so switched to / and it ran but gave the errors we are discussing.

from graphql-mongodb-example.

pmahmud avatar pmahmud commented on August 27, 2024

@AArmanD There are other ways to solve this, but here is a naive one:
copy populationScript.es6 from scripts folder and paste inside node_modules/babel/bin/ folder and cd into it and then run:
> node ./babel-node.js ./populationScript.es6

from graphql-mongodb-example.

idkjs avatar idkjs commented on August 27, 2024

@pmahmud that didnt work. This is totally to figure out what is possibly causing this issue that no one else has so dont feel pressed. Im thinking that since your project doesnt have a .babelrc file in it, the options manager is erroring out when it doesnt find it. I know there are other ways to do set babelrc options so maybe this should not affect it. Definite side project to learn something to run this down.

from graphql-mongodb-example.

idkjs avatar idkjs commented on August 27, 2024

@pmahmud maybe has something to do with this. CrabDude/babel-node-debug#7. Lots has happened with babel since you build this.

from graphql-mongodb-example.

sudheerj avatar sudheerj commented on August 27, 2024

I also got the same issue while running on windows machine.None of the solutions worked out.Any help is appreciated.

from graphql-mongodb-example.

sayden avatar sayden commented on August 27, 2024

@sudheerj In the case of Windows is probably a problem of paths. Scripts that you can find in package.json are *nix like paths that use "/" for the tree.

Windows uses "" (backslashes) so those script must be rewritten to work in Windows machines.

I'm sorry but I don't have any windows platform on hand right now

from graphql-mongodb-example.

sudheerj avatar sudheerj commented on August 27, 2024

Thanks Sayden.I installed babel plugins globally and changed the script paths as below.It worked fine after that.
"scripts": {
"start": "babel-node server.es6",
"populate": "babel-node scripts/populationScript.es6"
}

from graphql-mongodb-example.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.