-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Invalid command openapi, it's not registered #9703
Comments
由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。 |
umi4 不再自动加载插件,需要手动添加到配置: // .umirc.ts
export default {
plugins: ['...']
} 给一个最小复现。 |
这个是旧版插件,不支持 umi4 ,你可能需要这个 https://github.com/umijs/umi-presets-pro/tree/master/packages/max-plugin-openapi |
更换了max-plugin-openapi,项目本身启动没问题,不过umi openapi生成时候会报错:
config.js中openApi配置如下:
|
搞定了,需要在package.json中增加name配置~
|
如果出现 |
添加了umi-openapi插件,在配置中增加:
openAPI: [
{
......
},
],
package.json中增加script:
"openapi": "umi openapi"
执行 npm run openpai 报错:
fatal - AssertionError [ERR_ASSERTION]: Invalid command openapi, it's not registered.
at Service.run (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules@umijs\core\dist\service\service.js:226:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Service.run2 (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules\umi\dist\service\service.js:58:12)
at async Object.run (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules\umi\dist\cli\cli.js:55:7) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: true,
operator: '=='
}
运行项目报错:
fatal - AssertionError [ERR_ASSERTION]: Invalid config keys: openAPI
at Function.validateConfig (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules@umijs\core\dist\config\config.js:182:31)
at Config.getConfig (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules@umijs\core\dist\config\config.js:60:12)
at Service.resolveConfig (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules@umijs\core\dist\service\service.js:280:97)
at Service.run (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules@umijs\core\dist\service\service.js:237:50)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Service.run2 (D:\Code\IdeaProjects\house-paper\frontend-blockchain\node_modules\umi\dist\service\service.js:58:12)
The text was updated successfully, but these errors were encountered: