Open cartoon2541 opened 11 months ago
openapi is not a global cammand. It is not a exe file.It must depend on node to run. So you have two choices. First, you can run it by npx openapi-typescript-codegen --help
. Second, you can write it to package.json like following:
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/",
"codegen": "openapi --input ./openapi.json --output ./src/api-services"
},
And run it by npm run codegen
I install via command
npm install openapi-typescript-codegen --save-dev
in my project, and then i call
openapi --help
I got
sh: command not found: openapi
my project is nextjs and my dependencies look like
how can i do ?