{"record":{"id":"7c2424db2885b734","repo":"remotion-dev/remotion","slug":"installpackages-is-not-available-in-read-only-st","errorCode":null,"errorMessage":"installPackages() is not available in Read-Only Studio","messagePattern":"installPackages\\(\\) is not available in Read-Only Studio","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/api/install-package.ts","lineNumber":36,"sourceCode":"\t\twithRequiredAuxiliaryPackages(dependencies);\n\n\tconst browserStudioOperations = getBrowserStudioOperations();\n\tif (browserStudioOperations !== null) {\n\t\tconst response =\n\t\t\tawait browserStudioOperations.packageInstallation.installPackages({\n\t\t\t\tdependencies: dependenciesWithAuxiliaryPackages,\n\t\t\t});\n\t\tif (!response.success) {\n\t\t\tconst error = new Error(response.reason);\n\t\t\terror.stack = response.stack;\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn {};\n\t}\n\n\tif (window.remotion_isReadOnlyStudio) {\n\t\tthrow new Error('installPackages() is not available in Read-Only Studio');\n\t}\n\n\treturn callApi('/api/install-package', {\n\t\tdependencies: dependenciesWithAuxiliaryPackages,\n\t});\n};\n","sourceCodeStart":18,"sourceCodeEnd":43,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/api/install-package.ts#L18-L43","documentation":"Inside the Node-based Studio, installPackages() falls through to the local server API only when window.remotion_isReadOnlyStudio is false. Read-Only Studio is set when Studio is loaded from a static/index bundle without its server (renderEntry.tsx sets window.remotion_isReadOnlyStudio = true for bundleMode 'index') or when the Studio HTML is generated with the readOnlyStudio option (packages/studio-shared/src/studio-html.ts). Every mutating endpoint is refused in that mode.","triggerScenarios":"Calling installPackages() in a Studio that was statically deployed (no backing Studio server to run installs), or in an embed where the HTML was rendered with readOnlyStudio: true.","commonSituations":"Embedding Studio into another app as a static site; sharing previews from a deployed website build; testing Studio code against a static build instead of npx remotion studio.","solutions":["Run Studio locally with its server (npx remotion studio) when you need package installation.","In read-only deployments, hide the install affordance: check window.remotion_isReadOnlyStudio (or getRemotionEnvironment().isReadOnlyStudio) before rendering UI that calls installPackages().","Pre-install dependencies into the project instead of installing them at runtime in read-only setups.","Confirm you are not accidentally in Browser Studio mode - that path routes through browserStudioOperations earlier and has its own behavior."],"exampleFix":"// before\nimport {installPackages} from '@remotion/studio';\ninstallPackages([{name: 'lodash'}]); // throws in Read-Only Studio\n\n// after\nimport {getRemotionEnvironment} from 'remotion';\nimport {installPackages} from '@remotion/studio';\n\nif (getRemotionEnvironment().isStudio && !getRemotionEnvironment().isReadOnlyStudio) {\n  installPackages([{name: 'lodash'}]);\n} else {\n  // read-only deployment: disable the button / show guidance instead\n}","handlingStrategy":"validation","validationCode":"import {getRemotionEnvironment} from 'remotion';\n\nconst env = getRemotionEnvironment();\nif (env.isStudio && !env.isReadOnlyStudio) {\n  await installPackages([{name: 'lodash'}]);\n} else {\n  // read-only deployment - hide/disable the install affordance\n}","typeGuard":"import {getRemotionEnvironment} from 'remotion';\n\nexport const canInstallPackagesHere = (): boolean => {\n  const env = getRemotionEnvironment();\n  return env.isStudio && !env.isReadOnlyStudio;\n};","tryCatchPattern":"try {\n  await installPackages(deps);\n} catch (err) {\n  if (err.message.includes('Read-Only Studio')) {\n    // statically deployed Studio - cannot install at runtime; guide the user to run Studio locally\n  } else {\n    throw err;\n  }\n}","preventionTips":["Check getRemotionEnvironment().isReadOnlyStudio before rendering any UI that triggers package installation.","Remember: a statically deployed Studio (index bundle) has no server behind it - no mutating API works there.","Pre-install dependencies at build time for read-only deployments instead of installing at runtime."],"tags":["studio","read-only","api-misuse","package-installation"],"backgroundTag":"read-only-mode","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}