{"record":{"id":"5b185c34baad31f6","repo":"quasarframework/quasar","slug":"extendpackagejson-cannot-locate-extpkg-ski","errorCode":null,"errorMessage":"extendPackageJson() - cannot locate ${extPkg}. Skipping...","messagePattern":"extendPackageJson\\(\\) - cannot locate (.+?)\\. Skipping\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/lib/app-extension/api-classes/InstallAPI.js","lineNumber":146,"sourceCode":"    const json = getPackageJson(packageName, this.appDir)\n    return json !== void 0 ? json.version : void 0\n  }\n\n  /**\n   * Extend package.json with new props.\n   * If specifying existing props, it will override them.\n   *\n   * @param {object|string} extPkg - Object to extend with or relative path to a JSON file\n   */\n  extendPackageJson(extPkg) {\n    if (!extPkg) return\n\n    if (typeof extPkg === 'string') {\n      const dir = getCallerPath(1)\n      const source = path.resolve(dir, extPkg)\n\n      if (!fs.existsSync(source)) {\n        this.logger.warn(\n          `extendPackageJson() - cannot locate ${extPkg}. Skipping...`\n        )\n        return\n      }\n      if (fs.lstatSync(source).isDirectory()) {\n        this.logger.warn(\n          `extendPackageJson() - \"${extPkg}\" is a folder instead of file. Skipping...`\n        )\n        return\n      }\n\n      try {\n        extPkg = JSON.parse(fs.readFileSync(source, 'utf8'))\n      } catch {\n        this.logger.warn(\n          `extendPackageJson() - \"${extPkg}\" is malformed. Exiting...`\n        )\n        warn()","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/lib/app-extension/api-classes/InstallAPI.js#L128-L164","documentation":"InstallAPI.extendPackageJson(fnOrRelativePath) accepts a string path to a JSON fragment file, resolved relative to the caller (the extension's index.js directory via getCallerPath). If that file doesn't exist, the merge is skipped with this warning instead of throwing, so the extension's package.json additions are silently not applied.","triggerScenarios":"Calling api.extendPackageJson('./ext-package.json') from an extension's install script where the file does not exist relative to the extension's index.js directory.","commonSituations":"Typo in the relative filename; JSON file placed outside the folder getCallerPath resolves to (e.g. in a subfolder or repo root); publishing the extension without including the JSON file in the npm 'files' whitelist.","solutions":["Fix the relative path so it resolves from the extension's index.js directory","Ensure the JSON file is published (add it to package.json 'files' or remove the files whitelist restriction)","Alternatively pass a function instead of a path: extendPackageJson(pkg => { ... })","Verify with fs.existsSync from the extension during development"],"exampleFix":"// before\napi.extendPackageJson('./package-ext.json') // file not published\n// after: embed the merge as a function\napi.extendPackageJson(pkg => {\n  pkg.dependencies = pkg.dependencies || {}\n  pkg.dependencies['some-lib'] = '^1.0.0'\n})","handlingStrategy":"validation","validationCode":"// inside the extension's install script, before calling extendPackageJson\nconst path = require('path')\nconst fs = require('fs')\nconst fragment = path.resolve(__dirname, 'package-ext.json')\nif (!fs.existsSync(fragment)) {\n  throw new Error(`Missing package.json fragment: ${fragment}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve fragment paths with __dirname (matching getCallerPath) — never process.cwd()","Include JSON fragments in the npm 'files' list of the published extension","Prefer the function form extendPackageJson(pkg => {...}) to avoid path issues","Test your extension's install in a fresh host app before publishing"],"tags":["app-extension","install","package-json","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}