flipped-aurora/gin-vue-admin · error

server路径不存在

Error message

server路径不存在

What it means

PubPlug packages a plugin's web and server sources into a zip. After checking the web path it stats the computed server plugin directory (<AutoCode.Root>/<AutoCode.Server>/plugin/<name>); if it is missing it returns "server路径不存在" (server path does not exist).

Source

Thrown at server/service/system/auto_code_plugin.go:798

	}
	webPath, err := pluginPath(global.GVA_CONFIG.AutoCode.Web, plugName)
	if err != nil {
		return "", err
	}
	serverPath, err := pluginPath(global.GVA_CONFIG.AutoCode.Server, plugName)
	if err != nil {
		return "", err
	}
	// 创建一个新的zip文件

	// 判断目录是否存在
	_, err = os.Stat(webPath)
	if err != nil {
		return "", errors.New("web路径不存在")
	}
	_, err = os.Stat(serverPath)
	if err != nil {
		return "", errors.New("server路径不存在")
	}

	fileName := plugName + ".zip"
	// 创建一个新的zip文件
	files, err := archives.FilesFromDisk(context.Background(), nil, map[string]string{
		webPath:    plugName + "/web/plugin/" + plugName,
		serverPath: plugName + "/server/plugin/" + plugName,
	})

	// create the output file we'll write to
	out, err := os.Create(fileName)
	if err != nil {
		return
	}
	defer out.Close()

	// we can use the CompressedArchive type to gzip a tarball
	// (compression is not required; you could use Tar directly)

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Ensure server/plugin/<plugName> exists (re-install or scaffold the plugin server side).
  2. Check system config auto_code.root and auto_code.server point to the real server project root.
  3. Confirm the process user has read access to the directory.
  4. If only the web half exists, publish with a web-only flow instead of full packaging.

Example fix

// before
$ ls server/plugin  # myplugin missing
// after
$ mkdir -p server/plugin/myplugin  # or re-create the plugin server side
Defensive patterns

Strategy: validation

Validate before calling

serverPath := filepath.Join(cfg.AutoCode.Root, cfg.AutoCode.Server, "plugin", plugName)
if info, err := os.Stat(serverPath); err != nil || !info.IsDir() {
    return fmt.Errorf("server 插件目录不存在: %s", serverPath)
}
// safe to call PubPlug

Try / catch

path, err := plugService.PubPlug(plugName)
if err != nil {
    if strings.Contains(err.Error(), "server路径不存在") {
        return fmt.Errorf("server/plugin/%s 缺失,请先安装或重建该插件: %w", plugName, err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling PubPlug when the server-side plugin folder server/plugin/<plugName> does not exist — plugin never installed server-side, folder deleted, or autocode root/server config values pointing elsewhere.

Common situations: Publishing after removing the server half; wrong GVA_CONFIG.AutoCode.Root or .Server config; repo checked out without plugin directory.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/30b14c3dbc7526c2. Report an issue: GitHub.