quasarframework/quasar · error
Could not generate ${assetRelativePath}.
Error message
Could not generate ${assetRelativePath}. What it means
When copying a scaffold template from the @quasar/app-vite package into the project fails, `quasar new` logs the underlying fs error and warns 'Could not generate <path>' with a FAIL label. The command continues with other requested files and does not exit non-zero for this file. It indicates the template source or destination was unreadable/unwritable.
Source
Thrown at app-vite/lib/cmd/new.js:128
showError(`Invalid asset format: ${format} (valid values: js|ts)`)
}
function createFile({ targetFile, ext, reference }) {
const assetRelativePath = relative(appPaths.appDir, targetFile)
if (fs.existsSync(targetFile)) {
warn(`${assetRelativePath} already exists.`, 'SKIPPED')
console.log()
return
}
fse.ensureDir(dirname(targetFile))
const templatePath = join('templates/app', format, `${type}.${ext}`)
fse.copy(appPaths.resolve.cli(templatePath), targetFile, err => {
if (err) {
console.warn(err)
warn(`Could not generate ${assetRelativePath}.`, 'FAIL')
return
}
log(`Generated ${type}: ${assetRelativePath}`)
if (reference) {
log(`Make sure to reference it in ${reference}`)
}
log()
})
}
async function getAsset(assetType) {
if (assetType === 'page') {
return {
relativePath: 'src/pages',
ext: 'vue',
reference: `src/router/routes.${format}`
}View on GitHub (pinned to 4841521b5f)
Solutions
- Reinstall dependencies (`rm -rf node_modules && pnpm install`) to restore the CLI templates.
- Check write permissions on the target directory (and that you don't need sudo/a different owner).
- Re-run the `quasar new` command for the failed file and check the console.warn output above the warning for the exact fs error.
Example fix
// before (permission denied on src/pages) $ quasar new p Login -> Could not generate src/pages/Login.vue // after $ sudo chown -R $(whoami) . && pnpm install && quasar new p Login
Defensive patterns
Strategy: try-catch
Validate before calling
import { accessSync, constants } from 'node:fs';
try { accessSync('src/pages', constants.W_OK); } catch { console.error('no write permission on src/pages'); } Try / catch
// the CLI already catches; wrap programmatic invocations of the CLI instead
try {
execSync('quasar new p Login', { stdio: 'inherit' });
} catch (err) {
if (err.stderr?.includes('Could not generate')) reinstallTemplates();
} Prevention
- Reinstall node_modules if @quasar/app-vite templates appear missing.
- Run the CLI with write access to the project directory (no sudo-owned dirs).
- Watch the console.warn line above the warning for the root fs error.
When it happens
Trigger: fse.copy(appPaths.resolve.cli(templatePath), targetFile) invoking its error callback — e.g. the template file is missing from the installed CLI package, or the destination directory/file cannot be written (permissions, read-only fs) (new.js:125-130).
Common situations: Corrupted or partially pruned node_modules/@quasar/app-vite install; running inside a read-only container or without write permission to the project; antivirus locking files on Windows; project dir owned by another user (sudo mismatch).
Related errors
- Could not generate ${relativePath}.
- ${assetRelativePath} already exists.
- Could not resolve an existing ancestor for "${target}"
- Refusing to remove a filesystem root as build output
- Refusing to remove the user home directory as build output
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/87612e2220dcb430.
Report an issue: GitHub.