{"record":{"id":"30b14c3dbc7526c2","repo":"flipped-aurora/gin-vue-admin","slug":"server","errorCode":null,"errorMessage":"server路径不存在","messagePattern":"server路径不存在","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/service/system/auto_code_plugin.go","lineNumber":798,"sourceCode":"\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}\n\tdefer out.Close()\n\n\t// we can use the CompressedArchive type to gzip a tarball\n\t// (compression is not required; you could use Tar directly)","sourceCodeStart":780,"sourceCodeEnd":816,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/service/system/auto_code_plugin.go#L780-L816","documentation":"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).","triggerScenarios":"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.","commonSituations":"Publishing after removing the server half; wrong GVA_CONFIG.AutoCode.Root or .Server config; repo checked out without plugin directory.","solutions":["Ensure server/plugin/<plugName> exists (re-install or scaffold the plugin server side).","Check system config auto_code.root and auto_code.server point to the real server project root.","Confirm the process user has read access to the directory.","If only the web half exists, publish with a web-only flow instead of full packaging."],"exampleFix":"// before\n$ ls server/plugin  # myplugin missing\n// after\n$ mkdir -p server/plugin/myplugin  # or re-create the plugin server side","handlingStrategy":"validation","validationCode":"serverPath := filepath.Join(cfg.AutoCode.Root, cfg.AutoCode.Server, \"plugin\", plugName)\nif info, err := os.Stat(serverPath); err != nil || !info.IsDir() {\n    return fmt.Errorf(\"server 插件目录不存在: %s\", serverPath)\n}\n// safe to call PubPlug","typeGuard":null,"tryCatchPattern":"path, err := plugService.PubPlug(plugName)\nif err != nil {\n    if strings.Contains(err.Error(), \"server路径不存在\") {\n        return fmt.Errorf(\"server/plugin/%s 缺失，请先安装或重建该插件: %w\", plugName, err)\n    }\n    return err\n}","preventionTips":["Install/scaffold the plugin server-side before publishing a full package.","Confirm auto_code.root and auto_code.server config values match the actual layout.","Check read permissions on server/plugin directories.","Use a pre-publish script that asserts both halves of the plugin exist."],"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"}