Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphqelm CLI throws error #1

Closed
martimatix opened this issue Dec 18, 2017 · 5 comments
Closed

graphqelm CLI throws error #1

martimatix opened this issue Dec 18, 2017 · 5 comments

Comments

@martimatix
Copy link
Contributor

When I install the graphqelm module, and run graphqelm, I get the following error:

module.js:440
    throw err;
    ^

Error: Cannot find module '../dist/bundle.js'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/bin/graphqelm:3:1)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
@dillonkearns
Copy link
Owner

@martimatix thank you for reporting! I pushed a fix, should be all good now. I would love your feedback if you play around with it.

@martimatix
Copy link
Contributor Author

@dillonkearns Thanks for making the changes. Getting a different error now.

I installed version 0.0.3 globally (npm i -g graphqelm).

Running $ graphqelm, I get the following error message:

args { _: [] }
endpoint:  undefined
error TypeError: Parameter "url" must be a string, not undefined
    at Url.parse (url.js:79:11)
    at urlParse (url.js:73:5)
    at n (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:224151)
    at /Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:124795
    at new n (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:124761)
    at Object.n (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:124608)
    at Object.o (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:124438)
    at t.<anonymous> (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:123788)
    at n (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:123088)
    at Object.next (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:122423)

This is better than before because the program is telling me that I need to enter a URL.

I tried the Star Wars API on heroku as an argument: $ graphqelm https://graphqelm.herokuapp.com/api

I then get this message:

args { _: [ 'https://graphqelm.herokuapp.com/api' ] }
endpoint:  https://graphqelm.herokuapp.com/api
fs.js:634
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open './src/Api/Enum/Episode.elm'
    at Error (native)
    at Object.fs.openSync (fs.js:634:18)
    at Object.fs.writeFileSync (fs.js:1327:33)
    at Array.<anonymous> (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:42726)
    at Function.e [as func] (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:76830)
    at _ (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:45432)
    at r (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:75266)
    at Object.callback (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:75664)
    at _ (/Users/martimatix/.nvm/versions/node/v6.1.0/lib/node_modules/graphqelm/dist/bundle.js:1:79085)
    at Timeout.p [as _onTimeout] (/U%

I didn't really know what to expect but I guess I need to create ./src/Api/Enum/Episode.elm. After creating that file and installing the node module locally, the error message is similar to above but it complains that it can't find: './src/Api/Object/Character.elm'.

I stopped here because I felt that I was missing something. Do I need to create an elm file for each of the types of the graphql API prior to running the graphelm command?

@dillonkearns
Copy link
Owner

dillonkearns commented Dec 26, 2017 via email

@dillonkearns
Copy link
Owner

Whoops, I missed the second part of your message there, looks like you already figured out the issue with needing to create those directories. I've published a new version with a fix so that should all be working now! And it includes a change to print the usage info if you run the command without a url:

1__dillon_dillons-macbook-pro____src_graphqelm__zsh_

Don't hesitate to ping me with more issues/questions/feedback. Thanks!

@martimatix
Copy link
Contributor Author

Great work, Dillon! I ran graphqelm on the Star Wars API and the Github API using the auth header - that help message does its job - and both generated Elm files nicely. 👍

If I find anything else, I'll let you know. I'm Excited about this project and hope to see it grow in 2018.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants