pmcelhaney / counterfact

OpenAPI / Swagger to TypeScript generator and mock server
MIT License
83 stars 12 forks source link

Cannot start/use the counterfact #866

Closed jzillmann closed 1 month ago

jzillmann commented 1 month ago

From the 60 seconds guide

npx counterfact@latest https://petstore3.swagger.io/api/v3/openapi.json api --open

gives me the following print out

npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated json-schema-ref-parser@9.0.9: Please switch to @apidevtools/json-schema-ref-parser
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated json-schema-ref-parser@6.1.0: Please switch to @apidevtools/json-schema-ref-parser

and the command exited with with 127.

jzillmann commented 1 month ago

Tried the to install it locally: npm install --save-dev counterfact and now there is a meaningful error:

npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated json-schema-ref-parser@9.0.9: Please switch to @apidevtools/json-schema-ref-parser
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated json-schema-ref-parser@6.1.0: Please switch to @apidevtools/json-schema-ref-parser
npm ERR! code 127
npm ERR! path /Users/jz/Projects/hyezb/centrum_webapp/node_modules/counterfact
npm ERR! command failed
npm ERR! command sh -c patch-package
npm ERR! sh: patch-package: command not found

Installing patch-package (npm install -g patch-package) fixes the problem (also the 60 sec guide command).

dethell commented 1 month ago

I've seen this before and forgot to write up a ticket about it so we can get it fixed for first-time users. Thanks for digging in on your issue and writing up the work-around.

pmcelhaney commented 1 month ago

Thanks! I've moved patch-package into dependencies (instead of devdependencies) to fix this. patch-package is not needed to run the app, but because it's part of postinstall npx tries to install it (and then fails silently 🙈).

pmcelhaney commented 1 month ago

Fixed in 0.39.1. This one has come back a couple of times but it's fixed properly now.