Shaddix / react-query-swagger

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

nswag-portable: Permission denied issue (on MacOS) #21

Closed hijack401 closed 1 year ago

hijack401 commented 1 year ago

I was using your 15.5.4 version. However the update to 15.6.3 breaks for me. I'm getting the following issue:

(I'm on a Mac M1 MAX)

Command

npx react-query-swagger /tanstack /input:https://petstore.swagger.io/v2/swagger.json /output:src/web/api/axios-client.ts /template:Axios

Output

/bin/sh: /Users/username/Desktop/_GIT/projectname/src/web/node_modules/nswag-self-contained/bin/nswag-portable: Permission denied
node:child_process:915
    throw err;
    ^

Error: Command failed: "/Users/username/Desktop/_GIT/projectname/src/web/node_modules/nswag-self-contained/bin/nswag-portable" openapi2tsclient /templateDirectory:/Users/username/Desktop/_GIT/projectname/src/web/node_modules/react-query-swagger/templates /typeScriptVersion:4 /tanstack /input:https://petstore.swagger.io/v2/swagger.json /output:src/web/api/axios-client.ts /template:Axios
    at checkExecSyncError (node:child_process:841:11)
    at Object.execSync (node:child_process:912:15)
    at Object.<anonymous> (/Users/username/Desktop/_GIT/projectname/src/web/node_modules/nswag-self-contained/nswag-portable.js:11:14)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  status: 126,
  signal: null,
  output: [ null, null, null ],
  pid: 16896,
  stdout: null,
  stderr: null
}
Shaddix commented 1 year ago

Thanks for reporting! Will check and fix the coming hour

Shaddix commented 1 year ago

Should be fixed in 15.6.4, sorry for the troubles

hijack401 commented 1 year ago

This now results in a different error: cannot execute binary file

npx react-query-swagger /tanstack /input:https://petstore.swagger.io/v2/swagger.json /output:src/web/api/axios-client.ts /template:Axios
/bin/sh: /Users/username/Desktop/_GIT/projectname/src/web/node_modules/nswag-self-contained/bin/nswag-portable: cannot execute binary file
node:child_process:915
    throw err;
    ^

Error: Command failed: "/Users/username/Desktop/_GIT/projectname/src/web/node_modules/nswag-self-contained/bin/nswag-portable" openapi2tsclient /templateDirectory:/Users/username/Desktop/_GIT/projectname/src/web/node_modules/react-query-swagger/templates /typeScriptVersion:4 /tanstack /input:https://petstore.swagger.io/v2/swagger.json /output:src/web/api/axios-client.ts /template:Axios
    at checkExecSyncError (node:child_process:841:11)
    at Object.execSync (node:child_process:912:15)
    at Object.<anonymous> (/Users/username/Desktop/_GIT/projectname/src/web/node_modules/nswag-self-contained/nswag-portable.js:15:14)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  status: 126,
  signal: null,
  output: [ null, null, null ],
  pid: 49321,
  stdout: null,
  stderr: null
}
/Users/username/Desktop/_GIT/projectname/src/web/node_modules/react-query-swagger/cli.js:169
  throw new Error(e?.output?.toString());
  ^

Error: ,NSwag NPM CLI
,/bin/sh: /Users/username/Desktop/_GIT/projectname/src/web/node_modules/nswag-self-contained/bin/nswag-portable: cannot execute binary file
node:child_process:915
    throw err;
    ^
Shaddix commented 1 year ago

sorry, i've checked it on linux, but I didn't have a mac next to me. Gonna fix it today, meanwhile you could use 15.5.*

hijack401 commented 1 year ago

Yeah sure, no worries. Glad to test it when you have an update :)

Shaddix commented 1 year ago

Sorry for the delay, 15.6.7 finally fixes the issue

hijack401 commented 1 year ago

Nice! It works! Thanks for the fix.

denimamab commented 10 months ago

Hey ! Im facing the same issue on Mac M2: Version used: 15.10.3 Node version: v20.9.0

Output:

Error: Command failed: "/Users/.../Documents/lab/nest-js-open-api-generator/todo-api-client/node_modules/nswag-portable/bin/nswag-portable.mac.arm" openapi2tsclient /templateDirectory:/Users/.../Documents/lab/nest-js-open-api-generator/todo-api-client/node_modules/react-query-swagger/templates_minimal /typeScriptVersion:4 /tanstack /input:http://localhost:3000/api-json /output:api/axios-client.ts /template:Axios /minimal /generateOptionalParameters:true /typeStyle:Class /markOptionalProperties:true /nullValue:undefined /generateConstructorInterface:true /fix-null-undefined-serialization /modules
    at checkExecSyncError (node:child_process:890:11)
    at Object.execSync (node:child_process:962:15)
    at Object.<anonymous> (/Users/.../Documents/lab/nest-js-open-api-generator/todo-api-client/node_modules/nswag-portable/nswag-portable.js:19:14)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  status: null,
  signal: 'SIGKILL',
  output: [ null, null, null ],
  pid: 10662,
  stdout: null,
  stderr: null
}

Node.js v20.9.0
/Users/.../Documents/lab/nest-js-open-api-generator/todo-api-client/node_modules/react-query-swagger/cli.js:173
  throw new Error(e?.output?.toString());
  ^

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