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

/usr/bin/env: ‘node\r’: No such file or directory #2

Closed
capaj opened this issue Nov 17, 2021 · 22 comments
Closed

/usr/bin/env: ‘node\r’: No such file or directory #2

capaj opened this issue Nov 17, 2021 · 22 comments

Comments

@capaj
Copy link
Contributor

capaj commented Nov 17, 2021

I am getting

npx prisma-typegraphql-types-generator
/usr/bin/env: ‘node\r’: No such file or directory

when I try to run on ubuntu.
Are you developing on windows? Seems like this is a line ending issue like here:
docsifyjs/docsify-cli#78

maybe adding a .editorconfig could fix this.

@YassinEldeeb
Copy link
Owner

yep I'm on windows, I'll try using it with WSL to produce the issue and think of a solution

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

I have worked around this problem just by editing my node_modules/prisma-typegraphql-types-generator/dist/bin.js
and switching to LF from CRLF.
I have bumped into another issue though. The process just hangs up-

npx prisma-typegraphql-types-generator
prisma:info Prisma Typegraphql Types Generator:Registered

I can close it by sending an interrupt, but nothing is generated.

@YassinEldeeb
Copy link
Owner

yeah so that means that you've run the package yourself and It wasn't invoked by prisma.

@YassinEldeeb
Copy link
Owner

only the files will be generated when prisma is the one running the generator

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

Interesting. Will try that.

@YassinEldeeb
Copy link
Owner

sadly I don't have access to ubuntu rn, can you please try that.

yarn add prisma-typegraphql-types-generator@latest or
npm i prisma-typegraphql-types-generator@latest

then use this

  provider = "node_modules/prisma-typegraphql-types-generator"

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

give me 10-15 minutes

@YassinEldeeb
Copy link
Owner

cause I think the problem is caused due to running the package from npx and the unix format.

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

I am not sure why do you want me to test it again using "@latest". Latest version on NPM is still 1.0.10 which is the one I am using.

@YassinEldeeb
Copy link
Owner

yeah the solution is not with testing with the latest version, It's with depending on installed package in node_modules instead of loading it from npx.

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

I have tried that, I get:

$ cross-env SKIP_PRISMA_VERSION_CHECK=1 prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: Generator at node_modules/prisma-typegraphql-types-generator could not start:

/bin/sh: 1: node_modules/prisma-typegraphql-types-generator: Permission denied

@YassinEldeeb
Copy link
Owner

did you tried with sudo cause It's telling "Permission denied"

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

No, it's not a good practice to invoke npm scripts with sudo.
I have never seen an npm/yarn script which would require sudo.

@YassinEldeeb
Copy link
Owner

but then why the error is pointing to "Permission denied"?

@YassinEldeeb
Copy link
Owner

oh yeah yeah yeah sorry

@YassinEldeeb
Copy link
Owner

YassinEldeeb commented Nov 17, 2021

I forgot the "node" before it, that's reasonable why it's telling you that.

provider = "node node_modules/prisma-typegraphql-types-generator"

@YassinEldeeb
Copy link
Owner

did that work?

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

yes that works. TIL that typescript outputs line ending depending on the system where you run it. I would prefer LF always and only use CLRF when overriden.

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

I have opened a PR, because that bin file would still cause problems for people on unix based OSes, even with the workaround of invoking it through node

@YassinEldeeb
Copy link
Owner

YassinEldeeb commented Nov 17, 2021

merged you PR, Is it working properly now?

yarn add prisma-typegraphql-types-generator@latest to get the 1.0.13 version

and If it's working, Is it working with npx or with using invoking the package with node from node_modules workaround.

@YassinEldeeb
Copy link
Owner

It's working just fine as it was before on Windows, hope using LF line endings solved the issue on unix based systems.

@capaj
Copy link
Contributor Author

capaj commented Nov 17, 2021

tested with "prisma-typegraphql-types-generator": "^1.0.13",
works nicely

@capaj capaj closed this as completed Nov 17, 2021
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