xwj-vic / yapi

Apache License 2.0
76 stars 17 forks source link

无法安装其它部分插件,docker-compose环境变量中添加其它plugin后启动失败 #8

Closed YujiaCheng1996 closed 1 year ago

YujiaCheng1996 commented 1 year ago

版本号

~ 1007d68ecfe4 xuweijie1015/yapi:latest

什么问题

[3/5] Fetching packages...

error commander@10.0.1: The engine "node" is incompatible with this module. Expected version ">=14". Got "12.16.3"

error Found incompatible module.

info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

....

关闭引导服务...
尝试启动 YApi...
(node:1) UnhandledPromiseRejectionWarning: Error: Cannot find module 'yapi-plugin-webhook'
Require stack:
- /yapi/vendors/common/plugin.js
- /yapi/vendors/server/plugin.js
- /yapi/vendors/server/app.js
- /yapi/vendors/start.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at getPluginConfig (/yapi/vendors/common/plugin.js:8:20)
    at /yapi/vendors/common/plugin.js:39:22
    at Array.map (<anonymous>)
    at exports.initPlugins (/yapi/vendors/common/plugin.js:33:21)
    at Object.<anonymous> (/yapi/vendors/server/plugin.js:235:21)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/yapi/vendors/server/app.js:10:1)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

如何复现此问题

~ - YAPI_PLUGINS=[{"name":"add-user"},{"name":"export-schema"},{"name":"import-swagger-customize"},{"name":"webhook"},{"name":"notifier","options":{"host":"http://localhost:8090/"}}] ~ 环境变量中YAPI_PLUGINS不使用默认值,增加其他插件。 ~ import-swagger-customize这个是能够自动更新接口的,无法使用比较蛋疼。

什么浏览器

~ 无关

什么系统(Linux, Windows, macOS)Linux

xwj-vic commented 1 year ago

镜像基于https://github.com/fjc0k/docker-YApi 来构建,这个确实没法安装其他插件,add-user默认已经集成,可以不用配置,其他插件我可以先集成进来,后续有时间再搞一个可以下载插件的镜像。 不过yapi不是本身就提供自动更新接口的功能吗?import-swagger-customize这个插件会提供其他更友好的功能吗?

YujiaCheng1996 commented 1 year ago

之前用的 https://github.com/fjc0k/YApi-X 的docker镜像,是可以安装自定义的插件的,唯一的问题是太久没有更新,有漏洞。根据报错看大约是node版本低了,导致部分包无法安装。import-swagger-customize可以自定义更新或引入指定的接口,相比完整的更灵活一些。。。

xwj-vic commented 1 year ago

好的,后续我试一下基于 https://github.com/fjc0k/YApi-X 来构建新镜像。当前已经把上面提到的插件都加载到镜像内了,可以拉一下最新镜像体验一下

YujiaCheng1996 commented 1 year ago

谢谢,内置插件进去了首次启动快好多!