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
Cannot run - /usr/bin/env: ‘node\r’: Permission denied #10
Comments
Hi @mikaelsrozee , This is not an issue with this library - rather there seems to be a problem in your environment and lack of permissions. Did you install |
Hi @Enngage, thanks for getting back to me quickly. This isn't an issue with my environment, nor a lack of permissions. My suspicion is that this is due to the library being written using Windows file endings - When a Unix user (be it Mac or Linux) tries to exec the command line tool, their terminal will attempt to run the following:
which will fail, as if I were to just run the following command, it would work and load the node REPL
(and yes, Node is installed on my machine - see my original post) |
Ah, I see. If I remember correctly, some other user on Linux recommended to add this line -> https://github.com/Kentico/kontent-model-generator-js/blob/c2294c1f33b98728b9590154e9fb84f6619798ee/src/app.ts#L1 It seems to have helped him run this tool under Linux, not really sure what I could do to "fix" this. Feel free to let me know if you have an idea. |
I'm finding the same issue. The shebang should help, but the carriage returns from Windows aren't playing nicely with my Mac environment. |
I'm not sure how to improve/fix this, so if anyone has an idea, please let me know. |
I am having the same problem. It manifests if you install the package using Install crlf `❯ kontent-generate ❯crlf --set=LF node_modules/.bin/kontent-generate ❯ kontent-generate ` @Enngage needs to be fixed in the package creation.
|
Well the executable runs but I am getting a http 403 (not authorized). I suspect the line endings in the code are invalidating the http headers. From the output I can see.
|
I also really would like to see a solution to this. It is currently blocking us from choosing Kontent AI. |
Hi @ItsMeDelanoDev, We'll investigate internally and test the line endings. I don't have access to Mac, but I'll try to find someone who does. On another note, is there any particular reason you couldn't generate models using this approach https://github.com/kontent-ai/model-generator-js#generate-models-in-code ? It should be quite easy to implement this until there is an official way of running this library on MacOS. |
@Enngage it might also be an issue on linux as line endings work the same way. You could spin a linux server up somewhere in the cloud to test it too? Not sure how WSL works but that might be a bit quicker to test. |
I have just tried to generate the models in the code but the same thing happens. Which is not altogether surprising since it uses the same npm packages. Just to be clear, the error is as follows:
'authorization: bearer ewXXXXXXXXXXXXXXA8\r\n' |
@owain68 This error in particular points to the subscription API key, not the Management API key. My understanding is that this Subscription API is only needed to generate role types, I would suggest setting the exportRoles configuration value to false and see if this fixes the error you are receiving. |
I am still getting this error with the following code: https://gist.github.com/owain68/00dfaaccb5caea65063b4062d21f75ef |
What error? Additionally @JiriLojda found out that the issue only occurs when using |
@JiriLojda That's the same set up as my machine. What version of kontent-generator have you installed. I am running
|
@JiriLojda is using this :-) |
@Enngage I have deleted the npm_modules and reinstalled using npm and this problem does not occur. Unfortunate if you are using Yarn which I am. I had got that far and this workaround helped. But I think I need to also run the crlf against the management-sdk package as I think it is displaying the same issues. Perhaps you could try install using Yarn and see if you have the same issue. I have now come up with another problem and will raise an issue.#37 |
@Enngage Interesting, NPM seems to work indeed! Looks like the API request is only "broken" when installed with yarn. Thank you for your efforts! |
@Enngage is this being fixed or we just have to use npm in a separate project? Please close if you are not looking to resolve this issue. |
We'll probably try addressing this in future and see if we can do something about this I'll keep the issue open so that it's here, but the current recommendation is to use |
I tried a couple more scenarios all with the latest version of
|
Brief bug description
When trying to run
kontent-generate
, the binary crashes and fails to run with the error message:Repro steps
yarn global add @kentico/kontent-model-generator
ornpm i @kentico/kontent-model-generator -g
Expected behavior
Script should work
Test environment
Additional context
running the following command works as a workaround:
The text was updated successfully, but these errors were encountered: