quasarframework/quasar · critical

/src-cordova/package.json not found. Your setup seems broken

Error message

/src-cordova/package.json not found. Your setup seems broken. Please remove Cordova support and add it again.

What it means

When adding Cordova mode to a project where the mode is already installed, Quasar verifies src-cordova/package.json exists. If it doesn't, the scaffold is considered broken: this warning is printed, a blank line, and the process exits with code 1.

Source

Thrown at app-vite/lib/modes/cordova/cordova-installation.js:32

/**
 * @param {{
 *   ctx: import('../../../types/configuration/context').InternalQuasarContext,
 *   silent: boolean,
 *   target: 'android' | 'ios' | undefined,
 *   appId?: string
 * }} options
 */
export async function addMode({ ctx, silent, target, appId }) {
  const {
    appPaths,
    pkg: { appPkg }
  } = ctx

  if (isModeInstalled(appPaths, 'cordova')) {
    ensureWWW({ appPaths, forced: true })

    if (!fse.existsSync(appPaths.resolve.cordova('package.json'))) {
      warn(
        '/src-cordova/package.json not found. Your setup seems broken. Please remove Cordova support and add it again.'
      )
      warn()
      process.exit(1)
    }

    if (target) {
      await ensureModeDeps('cordova', ctx)
      await addPlatform(appPaths, target)
    } else if (silent !== true) {
      warn('Cordova support detected already. Aborting.')
    }

    return
  }

  const appName = appPkg.productName || appPkg.name || 'Quasar App'

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Delete the src-cordova directory completely and re-add support: quasar mode remove cordova (or rm -rf src-cordova) then quasar mode add cordova.
  2. If you have valuable native customizations, instead recreate a minimal src-cordova/package.json (cordova devDependency + scripts) matching your installed cordova version before retrying.
  3. Check git history/backup for the lost package.json and restore it to avoid re-adding platforms and plugins.

Example fix

# before
src-cordova/   (no package.json)
# after
rm -rf src-cordova
quasar mode add cordova
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
if (fs.existsSync('src-cordova') && !fs.existsSync('src-cordova/package.json')) {
  // broken scaffold — remove and re-add before invoking quasar mode add cordova
  fs.rmSync('src-cordova', { recursive: true, force: true });
}

Prevention

When it happens

Trigger: addMode in cordova-installation.js, when isModeInstalled(appPaths,'cordova') is true but fse.existsSync(appPaths.resolve.cordova('package.json')) is false — i.e. a src-cordova directory exists without its package.json.

Common situations: A partially deleted src-cordova folder (package.json removed by hand, .gitignore mishap, or interrupted `quasar mode add cordova`); restoring the folder from VCS without package.json because it was gitignored.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/0eb25f042a779c4e. Report an issue: GitHub.