Shaddix / react-query-swagger

Generates react-query hooks based on Swagger API definitions
MIT License
122 stars 4 forks source link

[bug] Bad CPU type in executable #30

Closed Arian94 closed 1 year ago

Arian94 commented 1 year ago

When entering:

npx react-query-swagger /tanstack /input:https://some-url /output:src/smth/axios-client.ts /template:Axios

it gives the following error:

.../node_modules/nswag-portable/bin/nswag-portable.mac: Bad CPU type in executable

The OS is Mac and it does not support 32-bit programs.

Shaddix commented 1 year ago

Thanks for reporting, gonna check tomorrow

Shaddix commented 1 year ago

sorry for delay. It was not 32-bit related, but rather ARM related. I assume you are using mac on M1 ARM processor, am I right?

In the last release I added support for ARM processors, so it should work fine. Though, I don't have such mac at hand, so I'd appreciate if you confirm it works (or confirm that it still doesn't work :))

Arian94 commented 1 year ago

Returned another error:

Node.js v18.16.1
/path/node_modules/react-query-swagger/cli.js:173
  throw new Error(e?.output?.toString());
  ^

Error: ,NSwag NPM CLI
,node:child_process:960
    throw err;
    ^
Shaddix commented 1 year ago

That's a bit strange. I just created a build on Bitrise (which actually just runs generate-axios script from here) and ran it on M1.

The build succeeds, logs are attached. Could you please double check that you are using the latest version of the lib?

apps_be75a00e-7f50-47d1-81f8-d7453fa86d47_f302debf-7a54-40fe-a763-8e2fe15e9bb0-full.txt

yusijs commented 10 months ago

@Shaddix I'm seeing the same error as reported by @Arian94

/Users/RHENRI/dev/tops-roma/roma-workbench/node_modules/react-query-swagger/cli.js:174
  throw new Error(e?.output?.toString());
  ^

Error: ,NSwag NPM CLI
,node:child_process:965
    throw err;
    ^

I'm on an M1 Max mbp, and I'm 100% sure I'm on the latest version: (snipped from package-lock.json)

"node_modules/react-query-swagger": {
      "version": "15.10.1",
      "resolved": "https://registry.npmjs.org/react-query-swagger/-/react-query-swagger-15.10.1.tgz",
      "integrity": "sha512-q4KXOkaZidhPeuLmsGkv+cBr2zwRGVY5nL4drM5apGcp5Fqo2vHzR/5yd842EKEbZIWvcTDE67OiQCtNvSiLSQ==",
      "dev": true,
      "dependencies": {
        "nswag-portable": "13.20.0-v.13"
      },
      "bin": {
        "react-query-swagger": "cli.js"
      },
      "peerDependencies": {
        "@tanstack/react-query": "> 4.0",
        "@tanstack/react-query-persist-client": ">4.2.0",
        "react": "17.x || 18.x",
        "react-query": ">= 3.33 < 4.0",
        "typescript": "> 3.0"
      }
    }

The issue may very well lie with NSwag though, I'm honestly not sure.. Not worked with neither library previously.