{"record":{"id":"c13594b294707c16","repo":"flipped-aurora/gin-vue-admin","slug":"web","errorCode":null,"errorMessage":"web路径不存在","messagePattern":"web路径不存在","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/service/system/auto_code_plugin.go","lineNumber":794,"sourceCode":"\nfunc (s *autoCodePlugin) PubPlug(plugName string) (zipPath string, err error) {\n\tif err = utils.ValidatePluginName(plugName); err != nil {\n\t\treturn \"\", err\n\t}\n\twebPath, err := pluginPath(global.GVA_CONFIG.AutoCode.Web, plugName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tserverPath, err := pluginPath(global.GVA_CONFIG.AutoCode.Server, plugName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// 创建一个新的zip文件\n\n\t// 判断目录是否存在\n\t_, err = os.Stat(webPath)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"web路径不存在\")\n\t}\n\t_, err = os.Stat(serverPath)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"server路径不存在\")\n\t}\n\n\tfileName := plugName + \".zip\"\n\t// 创建一个新的zip文件\n\tfiles, err := archives.FilesFromDisk(context.Background(), nil, map[string]string{\n\t\twebPath:    plugName + \"/web/plugin/\" + plugName,\n\t\tserverPath: plugName + \"/server/plugin/\" + plugName,\n\t})\n\n\t// create the output file we'll write to\n\tout, err := os.Create(fileName)\n\tif err != nil {\n\t\treturn\n\t}","sourceCodeStart":776,"sourceCodeEnd":812,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/service/system/auto_code_plugin.go#L776-L812","documentation":"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.","triggerScenarios":"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.","commonSituations":"Publishing a 'server' type plugin as 'full'; wrong GVA_CONFIG.AutoCode.Web path; working in a backend-only checkout that lacks the web tree.","solutions":["Ensure the directory <AutoCode.Web>/src/plugin/<plugName> exists before publishing.","Check system config auto_code.web points to the actual web project root.","If the plugin has no frontend part, publish with the appropriate type or create an empty plugin scaffold under web/src/plugin.","Verify filesystem permissions allow reading the directory."],"exampleFix":"// before\n$ ls web/src/plugin  # myplugin missing\n// after\n$ mkdir -p web/src/plugin/myplugin  # or install the plugin's web part first","handlingStrategy":"validation","validationCode":"webPath := filepath.Join(cfg.AutoCode.Web, \"src\", \"plugin\", plugName)\nif info, err := os.Stat(webPath); err != nil || !info.IsDir() {\n    return fmt.Errorf(\"web 插件目录不存在: %s\", webPath)\n}\n// safe to call PubPlug","typeGuard":null,"tryCatchPattern":"path, err := plugService.PubPlug(plugName)\nif err != nil {\n    if strings.Contains(err.Error(), \"路径不存在\") {\n        return fmt.Errorf(\"请先确认 %s 的 web/server 插件目录已生成: %w\", plugName, err)\n    }\n    return err\n}","preventionTips":["Verify both web/src/plugin/<name> and server/plugin/<name> exist before publishing.","Keep auto_code.web config pointing at the real web project root.","Avoid deleting plugin folders manually; use the plugin management UI.","In CI, run packaging on a full checkout including both web and server trees."],"tags":["filesystem","plugin","autocode","path"],"backgroundTag":"directory-not-found","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}