{"record":{"id":"43de635f8f8d3c4e","repo":"huiyadanli/RevokeMsgPatcher","slug":"apppath-package-json","errorCode":null,"errorMessage":"在路径{appPath}下，未找到package.json文件","messagePattern":"在路径(.+?)下，未找到package\\.json文件","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"RevokeMsgPatcher/Forms/FormLiteLoaderQQNT.cs","lineNumber":397,"sourceCode":"                    var s = (string)jsonObj.main;\n                    if (s.Contains(\"liteloader.h.js\"))\n                    {\n                        Debug.WriteLine(\"已经修改过package.json文件\");\n                        return;\n                    }\n                }\n\n                // 备份\n                File.Copy(packageJsonPath, Path.Combine(appPath, \"package.json.h.bak\"), true);\n\n                // 修改\n                jsonObj.main = \"./app_launcher/liteloader.h.js\";\n                string output = JsonConvert.SerializeObject(jsonObj, Formatting.Indented);\n                File.WriteAllText(packageJsonPath, output);\n            }\n            else\n            {\n                throw new Exception($\"在路径{appPath}下，未找到package.json文件\");\n            }\n        }\n\n        private void btnChoose_Click(object sender, EventArgs e)\n        {\n            FolderBrowserDialog dialog = new FolderBrowserDialog();\n            dialog.Description = \"请选择安装路径\";\n            if (dialog.ShowDialog() == DialogResult.OK)\n            {\n                if (string.IsNullOrEmpty(dialog.SelectedPath) || !IsAllFilesExist(dialog.SelectedPath))\n                {\n                    MessageBox.Show(\"无法找到此应用的关键文件，请选择正确的安装路径!\");\n                }\n                else\n                {\n                    txtQQNTPath.Text = dialog.SelectedPath;\n                }\n            }","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/huiyadanli/RevokeMsgPatcher/blob/89cbbb3f0cc896d5d092de0199a635c5c39944b6/RevokeMsgPatcher/Forms/FormLiteLoaderQQNT.cs#L379-L415","documentation":"ModifyPackageJson(appPath) edits <appPath>/package.json (backing it up first, then rewriting the main field). If package.json is absent it throws a plain Exception, because appPath did not resolve to QQNT's real app directory.","triggerScenarios":"appPath lacks package.json. Happens when the install path is wrong, when GetAppPath fell through to <install>/resources/app (because the versions folder was missing/empty) where no package.json exists, or when the app directory is corrupted.","commonSituations":"Wrong folder chosen (not the QQNT root); QQNT installed in a non-standard layout; versions folder exists but holds no version subdir.","solutions":["Verify the QQNT install path (must contain QQ.exe).","Ensure versions\\<ver>\\resources\\app\\package.json actually exists.","Reinstall QQNT to repair the app folder if it is corrupted."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"string packageJsonPath = Path.Combine(appPath, \"package.json\");\nif (!File.Exists(packageJsonPath))\n{\n    MessageBox.Show($\"{appPath} 下未找到 package.json，请确认安装路径是否正确。\");\n    return;\n}\nModifyPackageJson(appPath);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the QQNT install path resolves to a folder with package.json.","Ensure the versions subfolder is populated so GetAppPath picks a real version."],"tags":["liteloaderqqnt","install","path"],"backgroundTag":null,"analyzedSha":"89cbbb3f0cc896d5d092de0199a635c5c39944b6","analyzedAt":"2026-08-13T10:37:37.073Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}