{"record":{"id":"87612e2220dcb430","repo":"quasarframework/quasar","slug":"could-not-generate-assetrelativepath","errorCode":null,"errorMessage":"Could not generate ${assetRelativePath}.","messagePattern":"Could not generate (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app-vite/lib/cmd/new.js","lineNumber":128,"sourceCode":"  showError(`Invalid asset format: ${format} (valid values: js|ts)`)\n}\n\nfunction createFile({ targetFile, ext, reference }) {\n  const assetRelativePath = relative(appPaths.appDir, targetFile)\n\n  if (fs.existsSync(targetFile)) {\n    warn(`${assetRelativePath} already exists.`, 'SKIPPED')\n    console.log()\n    return\n  }\n\n  fse.ensureDir(dirname(targetFile))\n  const templatePath = join('templates/app', format, `${type}.${ext}`)\n\n  fse.copy(appPaths.resolve.cli(templatePath), targetFile, err => {\n    if (err) {\n      console.warn(err)\n      warn(`Could not generate ${assetRelativePath}.`, 'FAIL')\n      return\n    }\n\n    log(`Generated ${type}: ${assetRelativePath}`)\n    if (reference) {\n      log(`Make sure to reference it in ${reference}`)\n    }\n    log()\n  })\n}\n\nasync function getAsset(assetType) {\n  if (assetType === 'page') {\n    return {\n      relativePath: 'src/pages',\n      ext: 'vue',\n      reference: `src/router/routes.${format}`\n    }","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/lib/cmd/new.js#L110-L146","documentation":"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.","triggerScenarios":"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).","commonSituations":"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).","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."],"exampleFix":"// before (permission denied on src/pages)\n$ quasar new p Login  -> Could not generate src/pages/Login.vue\n// after\n$ sudo chown -R $(whoami) . && pnpm install && quasar new p Login","handlingStrategy":"try-catch","validationCode":"import { accessSync, constants } from 'node:fs';\ntry { accessSync('src/pages', constants.W_OK); } catch { console.error('no write permission on src/pages'); }","typeGuard":null,"tryCatchPattern":"// the CLI already catches; wrap programmatic invocations of the CLI instead\ntry {\n  execSync('quasar new p Login', { stdio: 'inherit' });\n} catch (err) {\n  if (err.stderr?.includes('Could not generate')) reinstallTemplates();\n}","preventionTips":["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."],"tags":["cli","scaffolding","filesystem","permissions"],"backgroundTag":"template-copy-failed","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}