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

CLI throwing error: "env: node\r: No such file or director" #17

Closed
Gr33nLight opened this issue Aug 28, 2022 · 4 comments
Closed

CLI throwing error: "env: node\r: No such file or director" #17

Gr33nLight opened this issue Aug 28, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Gr33nLight
Copy link

Hello I installed the following dependencies in a project:
yarn add -D kysely-codegen yarn add -D kysely pg
I have the .env file in the root of the directory, still, when i run the command
yarn run kysely-codegen
I get the error:
env: node\r: No such file or directory error Command failed with exit code 127.

@RobinBlomberg
Copy link
Owner

Try yarn add -D kysely-codegen@^0.5.2 and see if it helps.

I switched the TSConfig line endings to Unix style (LF), which might fix it, per this issue:

yarnpkg/yarn#8106

@RobinBlomberg RobinBlomberg added the bug Something isn't working label Aug 29, 2022
@Gr33nLight
Copy link
Author

Thanks! that fixed the issue.
I got another error after updating, I'm running node v14.18.2 btw. To verify I commented the lines that use the performance module in the generator.js file and the file db.d.ts was generated suuccessfully, but I thought I'd let you know about this error as well so you could investigate :)
Loaded environment variables from .env file. • No dialect specified. Assuming 'postgres'. (node:30527) UnhandledPromiseRejectionWarning: ReferenceError: performance is not defined at Generator.generate (/Users/gr33n/Documents/Dev/JS/ewi-frontend/node_modules/kysely-codegen/dist/generator.js:24:27) at Cli._Cli_generate (/Users/gr33n/Documents/Dev/JS/ewi-frontend/node_modules/kysely-codegen/dist/cli.js:68:21) at Cli.run (/Users/gr33n/Documents/Dev/JS/ewi-frontend/node_modules/kysely-codegen/dist/cli.js:41:80) at Object.<anonymous> (/Users/gr33n/Documents/Dev/JS/ewi-frontend/node_modules/kysely-codegen/dist/bin/index.js:5:22) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:12) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 (Usenode --trace-warnings ...to show where the warning was created) (node:30527) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:30527) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@RobinBlomberg
Copy link
Owner

Glad to hear that it fixed it!

Node.js LTS (long term support) version is 16.17.0 now, and while I think I'll avoid supporting legacy versions, I think import { performance } from 'perf_hooks' is an easy enough fix. I'll jump on it.

@RobinBlomberg
Copy link
Owner

Fixed in kysely-codegen@^0.5.3!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants