quasarframework/quasar · error

Could not generate ${relativePath}.

Error message

Could not generate ${relativePath}.

What it means

When creating a store for the first time, `quasar new store` bulk-copies the store template folder for the detected store provider (Pinia/Vuex) into src/<pathKey>. If that recursive copy throws, the CLI logs the error, warns 'Could not generate <path>' and exits with code 1 — the store is left unusable and must be regenerated.

Source

Thrown at app-vite/lib/cmd/new.js:202

    const targetFolder = appPaths.resolve.app(relativePath)

    if (!storeProvider.isInstalled) {
      await storeProvider.install()
    }

    if (!fs.existsSync(targetFolder)) {
      fse.ensureDir(targetFolder)

      try {
        fse.copySync(
          appPaths.resolve.cli(
            `templates/store/${storeProvider.name}/${format}`
          ),
          targetFolder
        )
      } catch (err) {
        console.warn(err)
        warn(`Could not generate ${relativePath}.`, 'FAIL')
        process.exit(1)
      }

      log(`Generated ${relativePath}`)
    }

    return {
      relativePath,
      ext: format
    }
  }
}

const { relativePath, ext, reference } = await getAsset(type)
const fullExt = `.${ext}`

console.log()

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Fix the underlying fs error shown in console.warn (permissions/disk space) and re-run `quasar new store <name>`.
  2. Reinstall dependencies to restore templates: `rm -rf node_modules && pnpm install`.
  3. Verify the store provider installed correctly (check package.json for pinia/vuex) and, if needed, create src/stores manually before retrying.

Example fix

// before
$ quasar new s auth -f ts  -> Could not generate src/stores. exit 1
// after
$ rm -rf node_modules && pnpm install
$ quasar new s auth -f ts
Defensive patterns

Strategy: try-catch

Validate before calling

import { accessSync, constants } from 'node:fs';
try { accessSync('.', constants.W_OK); } catch { console.error('project dir not writable'); }
// also confirm store provider is declared: package.json contains pinia or vuex

Try / catch

try {
  execSync(`quasar new s ${name} ${fmt}`, { stdio: 'inherit' });
} catch (err) {
  // CLI exits 1 here; check store folder and reinstall deps before retry
  reinstallDeps();
  execSync(`quasar new s ${name} ${fmt}`, { stdio: 'inherit' });
}

Prevention

When it happens

Trigger: fse.copySync(appPaths.resolve.cli(`templates/store/${storeProvider.name}/${format}`), targetFolder) throwing — template folder missing for the provider/format combination, or target not writable (new.js:193-204). Only happens when src/stores or src/store does not exist yet.

Common situations: First store creation in a fresh project with a broken @quasar/app-vite install; forcing -f ts where the template set is incomplete; permission issues in the project directory; store provider auto-install (storeProvider.install) succeeded but template copy failed.

Related errors


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