-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
SafeQL installation fails on Windows #80
Comments
That's not exactly an issue of SafeQL, but libpg-query. One of my machines is using Windows, but all of the development occurs in WSL (Windows Subsystem for Linux) and it seems to work fine. Another workaround that I can think of is using Docker. |
I'll take a look at https://github.com/taozhi8833998/node-sql-parser as well |
I ran some tests, and it looks like SELECT ((colname + INTERVAL '1 month')::DATE - 1) as x If I change it to this (which I believe will result in a runtime error; haven't checked): SELECT (colname + INTERVAL '1 month')::DATE - 1 as x it will throw an error. I believe we should stick with |
Any chance you could mention that this doesn't work on Windows on your website and/or the readme file? Just spent a good amount of time trying to figure out why this wasn't installing. I am looking forward to using it someday! |
@gregnr opened a PR using |
Hopefully should be resolved if Hilzu/libpg-query-node#11 will be resolved as well. |
Thanks to @lfittl |
There's a PR by @aquariuslt open in |
The PR has been merged and published as |
@Eprince-hub can you confirm that SafeQL performs checking and shows errors and warnings on Windows now? |
Just trying out the new
This appears to be related to the Node.js requirement on Windows to "need to write There are no ESM errors or warnings from the ESLint run on Windows when SafeQL is disabled: So this appears to be a SafeQL-specific bug with Windows support. cc @Newbie012 |
Actually, looking at this closer and trying to create a reproduction, it looks like it's something else in upleveled/preflight-test-project-next-js-passing#156 (comment) Edit: Yes confirmed, the problem with It seems like using +import { pathToFileURL } from 'node:url';
-await import(`${process.cwd()}/package.json`, {
+await import(pathToFileURL(`${process.cwd()}/package.json`).href, {
assert: { type: 'json' },
}); |
I have now successfully been able to receive a SafeQL error on GitHub Actions, on a Windows runner 🎉 await sql`
INSERT INTO
loogos (name)
VALUES
('Next.js'),
('Next.js'),
('Next.js'),
('Next.js')
`; SafeQL error: $ pnpm eslint . --max-warnings 0
(node:2004) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
D:\a\preflight-test-project-next-js-passing\preflight-test-project-next-js-passing\migrations\00000-create-table-logos.ts
Error: 25:7 error Invalid Query: relation "loogos" does not exist @ts-safeql/check-sql
✖ 1 problem (1 error, 0 warnings)
Error: Process completed with exit code 1.
While testing the Windows SafeQL issue, I created a cross-platform PostgreSQL + SafeQL reproduction repo (Windows, macOS and Linux runners). Now that I solved it, I thought this may also be a useful thing for users of the SafeQL project longer term (eg. for users demonstrating their bugs): cc @Newbie012 , in case we should integrate this into the issue workflow on GitHub. |
@Eprince-hub if you could do one more check from your side on your Windows system, then I think this issue can be closed. |
@karlhorky Because of the issue with a long path not being found by node on Windows: nodejs/node#50753 I needed to run the two scripts below to get it working echo 'node-linker=hoisted' > ./.npmrc pnpm install --force I will be closing this issue as it is now confirmed that SafeQL can be installed and used on Windows Machines |
Describe the bug
SafeQL can not be installed on Windows 10 / 11. This is due to one of the dependencies,
libpg-query
that doesn't currently support installation on windows machines according to the issue here launchql/libpg-query-node#22Running
yarn add --dev @ts-safeql/eslint-plugin libpg-query
throws the following errorsTo Reproduce
You can try this installation on this repo
A computer running windows OS is needed to reproduce this error
clone
projectcd
into projectcd libpg-query-installation-error
install
SafeQLExpected behaviour
Install SafeQL on a windows computer without an issue
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: