flipped-aurora/gin-vue-admin · error

web路径不存在

Error message

web路径不存在

What it means

PubPlug packages a plugin into a distributable zip containing both web and server parts. Before zipping it stats the computed web plugin directory; if os.Stat fails (directory missing or unreadable) it returns "web路径不存在" (web path does not exist) and aborts packaging.

Source

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

func (s *autoCodePlugin) PubPlug(plugName string) (zipPath string, err error) {
	if err = utils.ValidatePluginName(plugName); err != nil {
		return "", err
	}
	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
	}

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Ensure the directory <AutoCode.Web>/src/plugin/<plugName> exists before publishing.
  2. Check system config auto_code.web points to the actual web project root.
  3. If the plugin has no frontend part, publish with the appropriate type or create an empty plugin scaffold under web/src/plugin.
  4. Verify filesystem permissions allow reading the directory.

Example fix

// before
$ ls web/src/plugin  # myplugin missing
// after
$ mkdir -p web/src/plugin/myplugin  # or install the plugin's web part first
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

path, err := plugService.PubPlug(plugName)
if err != nil {
    if strings.Contains(err.Error(), "路径不存在") {
        return fmt.Errorf("请先确认 %s 的 web/server 插件目录已生成: %w", plugName, err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling PubPlug for a plugin whose web plugin folder (config autocode web root /src/plugin/<name>) does not exist — e.g. plugin was created server-only, the web folder was deleted/renamed, or the web root config points at the wrong directory.

Common situations: Publishing a 'server' type plugin as 'full'; wrong GVA_CONFIG.AutoCode.Web path; working in a backend-only checkout that lacks the web tree.

Related errors


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