{"record":{"id":"a33f4a13ebf07e86","repo":"remotion-dev/remotion","slug":"could-not-determine-version-of-installed-remotion","errorCode":null,"errorMessage":"Could not determine version of installed Remotion packages: ${(err as Error).message}","messagePattern":"Could not determine version of installed Remotion packages: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/add.ts","lineNumber":130,"sourceCode":"\tconst installedRemotionPackages = listOfRemotionPackages.filter((pkg) =>\n\t\tallDeps.includes(pkg),\n\t);\n\n\t// Get the version from the first installed Remotion package\n\tconst packageJsonPath = `${remotionRoot}/node_modules/${installedRemotionPackages[0]}/package.json`;\n\tlet targetVersion: string | null = null;\n\n\tif (installedRemotionPackages.length > 0) {\n\t\ttry {\n\t\t\tconst packageJson = require(packageJsonPath);\n\t\t\ttargetVersion = packageJson.version;\n\t\t\tconst packageList =\n\t\t\t\ttoInstall.length === 1\n\t\t\t\t\t? toInstall[0]\n\t\t\t\t\t: `${toInstall.length} packages (${toInstall.join(', ')})`;\n\t\t\tLog.info({indent: false, logLevel}, `Installing ${packageList}`);\n\t\t} catch (err) {\n\t\t\tthrow new Error(\n\t\t\t\t`Could not determine version of installed Remotion packages: ${(err as Error).message}`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\t// If no Remotion packages are installed, we can only install extra packages\n\t\tconst notExtraPackages = toInstall.filter((pkg) => !EXTRA_PACKAGES[pkg]);\n\t\tif (notExtraPackages.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t'No Remotion packages found in your project. Install Remotion first.',\n\t\t\t);\n\t\t}\n\t}\n\n\tconst manager = StudioServerInternals.getPackageManager({\n\t\tremotionRoot,\n\t\tpackageManager,\n\t\tdirUp: 0,\n\t\tlogLevel,","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cli/src/add.ts#L112-L148","documentation":"When at least one Remotion package is already installed, `addCommand` resolves the installed package.json via `require(packageJsonPath)` to read `version`. If that require/parse throws (file missing, unreadable, or invalid JSON), the underlying error message is wrapped and re-thrown so the target install version cannot be determined.","triggerScenarios":"The installed Remotion package's package.json is missing, not readable, or contains invalid JSON; `resolveFrom` pointed at a path that does not exist; filesystem/permission issues; a corrupted node_modules.","commonSituations":"Corrupted or partially-deleted node_modules; manually edited package.json with syntax errors; permission errors reading the file; a broken symlink in node_modules.","solutions":["Reinstall dependencies (delete node_modules and lockfile-install) to restore a valid package.json.","Verify the installed Remotion package's package.json is valid JSON.","Check filesystem permissions on node_modules.","If a specific package is implicated, reinstall just that package."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import fs from 'node:fs';\nfunction installedVersionReadable(pkgJsonPath: string): boolean {\n  try {\n    JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));\n    return true;\n  } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try { await addCommand({...}); }\ncatch (e) {\n  if (e instanceof Error && /Could not determine version/.test(e.message)) {\n    await reinstallNodeModules();\n  }\n}","preventionTips":["Keep node_modules intact; reinstall if corrupted.","Validate package.json files are well-formed JSON.","Check filesystem permissions before running add."],"tags":["cli","add","packages","filesystem","version"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}