{"record":{"id":"06542a53e241203b","repo":"FlowiseAI/Flowise","slug":"please-install-replicate-as-a-dependency-with-e-g","errorCode":null,"errorMessage":"Please install replicate as a dependency with, e.g. `yarn add replicate`","messagePattern":"Please install replicate as a dependency with, e\\.g\\. `yarn add replicate`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/llms/Replicate/core.ts","lineNumber":105,"sourceCode":"\n            // stream is done\n            if (chunk.event === 'done')\n                yield new GenerationChunk({\n                    text: '',\n                    generationInfo: { finished: true }\n                })\n        }\n    }\n\n    /** @ignore */\n    static async imports(): Promise<{\n        Replicate: typeof ReplicateInstance\n    }> {\n        try {\n            const { default: Replicate } = await import('replicate')\n            return { Replicate }\n        } catch (e) {\n            throw new Error('Please install replicate as a dependency with, e.g. `yarn add replicate`')\n        }\n    }\n\n    private async _prepareReplicate(): Promise<ReplicateInstance> {\n        const imports = await Replicate.imports()\n\n        return new imports.Replicate({\n            userAgent: 'flowise',\n            auth: this.apiKey\n        })\n    }\n\n    private async _getReplicateInput(replicate: ReplicateInstance, prompt: string) {\n        if (this.promptKey === undefined) {\n            const [modelString, versionString] = this.model.split(':')\n            if (versionString) {\n                const version = await replicate.models.versions.get(modelString.split('/')[0], modelString.split('/')[1], versionString)\n                const openapiSchema = version.openapi_schema","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/llms/Replicate/core.ts#L87-L123","documentation":"The static imports() dynamically imports the replicate package; if resolution fails it re-throws with this install hint. Runtime module-resolution failure, not a network error.","triggerScenarios":"First _call/_prepareReplicate triggers imports(); the replicate npm package is missing from node_modules in the deployment.","commonSituations":"Trimmed build that excluded optional deps; production image built without installing the components package's dependencies; monorepo hoisting issue.","solutions":["Install the package: yarn add replicate (or pnpm add replicate).","Rebuild/redeploy so node_modules contains the package.","Verify resolution: node -e \"require.resolve('replicate')\"."],"exampleFix":"// before: replicate missing\n// after\nyarn add replicate","handlingStrategy":"validation","validationCode":"try { require.resolve('replicate') }\ncatch { throw new Error('Run: yarn add replicate before using the Replicate node') }","typeGuard":"async function replicateAvailable(): Promise<boolean> {\n  try { await import('replicate'); return true } catch { return false }\n}","tryCatchPattern":"try {\n  const { default: Replicate } = await import('replicate')\n} catch {\n  throw new Error('Install replicate to use this node')\n}","preventionTips":["Declare replicate in the components package.json dependencies.","Smoke-test require.resolve at boot.","Rebuild images after adding the dependency.","Ensure monorepo hoisting keeps the package resolvable."],"tags":["replicate","dependency","install","runtime","module-resolution"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}