quasarframework/quasar · warning
extendPackageJson() - cannot locate ${extPkg}. Skipping...
Error message
extendPackageJson() - cannot locate ${extPkg}. Skipping... What it means
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.
Source
Thrown at app-vite/lib/app-extension/api-classes/InstallAPI.js:146
const json = getPackageJson(packageName, this.appDir)
return json !== void 0 ? json.version : void 0
}
/**
* Extend package.json with new props.
* If specifying existing props, it will override them.
*
* @param {object|string} extPkg - Object to extend with or relative path to a JSON file
*/
extendPackageJson(extPkg) {
if (!extPkg) return
if (typeof extPkg === 'string') {
const dir = getCallerPath(1)
const source = path.resolve(dir, extPkg)
if (!fs.existsSync(source)) {
this.logger.warn(
`extendPackageJson() - cannot locate ${extPkg}. Skipping...`
)
return
}
if (fs.lstatSync(source).isDirectory()) {
this.logger.warn(
`extendPackageJson() - "${extPkg}" is a folder instead of file. Skipping...`
)
return
}
try {
extPkg = JSON.parse(fs.readFileSync(source, 'utf8'))
} catch {
this.logger.warn(
`extendPackageJson() - "${extPkg}" is malformed. Exiting...`
)
warn()View on GitHub (pinned to 4841521b5f)
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
Example fix
// before
api.extendPackageJson('./package-ext.json') // file not published
// after: embed the merge as a function
api.extendPackageJson(pkg => {
pkg.dependencies = pkg.dependencies || {}
pkg.dependencies['some-lib'] = '^1.0.0'
}) Defensive patterns
Strategy: validation
Validate before calling
// inside the extension's install script, before calling extendPackageJson
const path = require('path')
const fs = require('fs')
const fragment = path.resolve(__dirname, 'package-ext.json')
if (!fs.existsSync(fragment)) {
throw new Error(`Missing package.json fragment: ${fragment}`)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- extendPackageJson() - "${extPkg}" is a folder instead of fil
- extendPackageJson() - "${extPkg}" is malformed. Exiting...
- Failed to render template "${sourcePath}". This may break th
- Quasar App Extension is not installed...
- Quasar App Extension is missing...
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/5b185c34baad31f6.
Report an issue: GitHub.