yarax / swagger-to-graphql

Swagger to GraphQL API adapter
MIT License
924 stars 150 forks source link

Resolving Peer Dependencies #138

Closed RajHenry closed 5 years ago

RajHenry commented 5 years ago

I am getting this error.

C:\Path\GraphiQL\codebase\swagger-to-graphql>npm i -g swagger-to-graphql C:\Users\Path\AppData\Roaming\npm\swagger-to-graphql -> C:\Users\Path\AppData\Roaming\npm\node_modules\swagger-to-graphql\bin\swagger2graphql npm WARN swagger-to-graphql@1.8.0 requires a peer of graphql@^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.

To resolve the above error, i ran the command npm add my-graphql-library graphql as suggested in an article and i get the below error. How do i proceed now?

C:\Path\GraphiQL\codebase\swagger-to-graphql>npm add my-graphql-library graphql npm ERR! code E404 npm ERR! 404 Not Found — GET https://registry.npmjs.org/my-graphql-library — Not found npm ERR! 404 npm ERR! 404 ‘my-graphql-library@latest’ is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\rhenry\AppData\Roaming\npm-cache_logs\2019–08–01T23_35_33_229Z-debug.log

yarax commented 5 years ago

@0xR I see you made graphql peer dependency, what was the reason for that? Besides installation problems, I guess we depend on a certain version of GraphQL

0xR commented 5 years ago

@yarax It should be a peerDependency to avoid getting multiple instances of graphql in your project.

@RajHenry npm add graphql should solve your problem. Your command npm add my-graphql-library graphql tries to add my-graphql-library and graphql. This fails because my-graphql-library does not exist.