ts-safeql / safeql

Validate and auto-generate TypeScript types from raw SQL queries in PostgreSQL.
https://safeql.dev
MIT License
1.35k stars 22 forks source link

incompatible architecture eslint error #244

Closed jiradedm closed 3 months ago

jiradedm commented 4 months ago

Describe the bug eslint error

To Reproduce start eslint with @ts-safeql/eslint-plugin plugin on mac m2

Expected behavior start eslint without error

Screenshots

image

Desktop (please complete the following information):

karlhorky commented 4 months ago

Interesting, that seems to indicate that you're running Node.js + ESLint in x86_64 mode (maybe using Rosetta?)

@jiradedm do you have any idea why that would be?

I would suggest looking in to what program is running the shell that is running Node.js + ESLint - maybe that program is running in Rosetta mode and it should not be.

Eg. if that screenshot was in VS Code, maybe you have an "Intel Chip" VS Code version instead of the "Apple silicon" version?

I would definitely recommend changing all software to the Apple Silicon version - fewer compatibility problems and also a performance boost.

jiradedm commented 4 months ago

screenshots above use vscode "universal" without "open using rosetta" checked. then I tried "Apple Silicon" and still got the error. but the error gone when I opened vscode "universal" with "open using rosetta" checked.

karlhorky commented 4 months ago

Ahh then maybe it's the opposite error:

  1. Dependencies were installed with Rosetta somewhere (eg. a Terminal that had Rosetta x86 emulation enabled at the time)
  2. Now the version of libpg-query in node_modules is the x86 version, which will fail if run with a non-Rosetta Node.js + ESLint environment

I guess the more permanent solution may be to delete node_modules and reinstall with an Apple Silicon terminal environment.

jiradedm commented 4 months ago

I run command "arch" in my terminal (used in installing packages) and get "i386" (probaby config a long time ago) then run it in vscode terminal and get "arm64", so I run "exec arch -arm64 $SHELL" to change to arm64, then delete node_modules and package-lock.json then install package again but still get an error.

and I tried install packages via vscode terminal (assume it'll use the same environment) and still get an error

Newbie012 commented 4 months ago

Sounds more like a setup issue rather than SafeQL's.

Try opening a new terminal, re-installing node modules and running ESLint (without opening vs code). I believe it should work as expected. In any case, The language service doesn't necessarily use the same arch as your default terminal arch.

Newbie012 commented 3 months ago

I'm closing this issue for now due to inactivity.