Unable to run when redocly is installed
The popular redocly package installs a bin with the name openapi. (It also links the same binary using the better name redocly).
This package only contains a single ambiguously-named binary openapi, so in case redocly is installed, it's impossible to exec this package, since redocly's binary will shadow it (depending on package manager whims).
Solution: This package should deprecate the openapi binary (can still keep it for backwards compat) and use a more descriptive script name such as openapi-ts-codegen or whatever. (Note that the same script can be linked under multiple different names so this would be a trivial package.json change.)
I upvote this issue as I have the same problem.
For now, I use openapi-typecript-codegen with the following workaround :
node node_modules/openapi-typescript-codegen/bin/index.js --input ./my-specification.json --output ./generated/models/