Skip to content

执行报错:Cannot read property 'get' of undefined #238

@StreakingMan

Description

@StreakingMan

参照示例配置,在空项目中运行报错。

node: v14.21.3
npm: 6.14.18
package manager: npm

openapi.config.cjs

// openapi.config.cjs
const { defineConfig } = require('openapi-axios');

module.exports = defineConfig({
    openAPIs: [
        {
            // 将会生成 src/apis/swagger/petStore3.ts 文件
            name: 'swagger/petStore3',
            // 可以是一个 URL 链接或者本地路径,或者一个 OPENAPI3 文档对象
            document: 'https://petstore3.swagger.io/api/v3/openapi.json',
        },
    ],
});

package.json

{
  "name": "empty-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "axios": "^1.4.0",
    "openapi-axios": "^0.15.1",
    "typescript": "^5.1.3"
  }
}

output

Cannot read property 'get' of undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions