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

json-graphql-server: command not found #176

Open
pdehaan opened this issue Jul 21, 2024 · 1 comment
Open

json-graphql-server: command not found #176

pdehaan opened this issue Jul 21, 2024 · 1 comment
Assignees
Labels

Comments

@pdehaan
Copy link

pdehaan commented Jul 21, 2024

What you were expecting:
npm is unable to find the json-graphql-server command

What happened instead:

npx json-graphql-server db.cjs
sh: json-graphql-server: command not found


ls -lh ./node_modules/.bin
lrwxr-xr-x  1 pdehaan  staff    18B 20 Jul 23:22 acorn -> ../acorn/bin/acorn
lrwxr-xr-x  1 pdehaan  staff    22B 20 Jul 23:22 loose-envify -> ../loose-envify/cli.js
lrwxr-xr-x  1 pdehaan  staff    14B 20 Jul 23:22 mime -> ../mime/cli.js
lrwxr-xr-x  1 pdehaan  staff    20B 20 Jul 23:22 semver -> ../semver/bin/semver

Steps to reproduce:
Installed json-graphql-server locally via npm i json-graphql-server -D and populated my db.cjs flie and then tried to run with npx json-graphql-server db.cjs and got the errors above.

Looks like the filename is ./bin/json-graphql-server.cjs.
But I think the bin command in package.json still points to ./bin/json-graphql-server.js (and not .cjs)

"bin": {
"json-graphql-server": "bin/json-graphql-server.js"
}

Related code:

Workaround is to try and run the json-graphql-server directly from ./node_modules/json-graphql-server/bin/json-graphql-server.cjs and not from ./node_modules/.bin/json-graphql-server` alias.

./node_modules/json-graphql-server/bin/json-graphql-server.cjs db.cjs
GraphQL server running with your data at http://localhost:3000/

Other information:

Environment

  • Last version that did not exhibit the issue (if applicable):
  • Browser:
@fzaninotto
Copy link
Member

Thanks for the report. I'm marking this as a bug.

@fzaninotto fzaninotto added the Bug label Jul 22, 2024
@fzaninotto fzaninotto self-assigned this Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants