{"record":{"id":"4f8c47271664f2c6","repo":"perspective-dev/perspective","slug":"anywidget-bundle-is-not-present-in-perspective-wid","errorCode":null,"errorMessage":"anywidget bundle is not present in perspective/widget/static, please build `@perspective-dev/anywidget`","messagePattern":"anywidget bundle is not present in perspective/widget/static, please build `@perspective-dev/anywidget`","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"rust/perspective-python/build.mjs","lineNumber":138,"sourceCode":"    const cargo = toml.parse(cargo_toml);\n    const pyproject = toml.parse(pyproject_toml);\n    const version = cargo[\"package\"][\"version\"];\n    const data_dir = `perspective_python-${version}.data`;\n    const testfile = path.join(\n        data_dir,\n        \"data/share/jupyter/labextensions/@perspective-dev/jupyterlab/package.json\",\n    );\n\n    if (!fs.existsSync(testfile)) {\n        throw new Error(\n            \"labextension is not present in data directory, please build `perspective-jupyterlab`\",\n        );\n    }\n\n    if (\n        !fs.existsSync(\"perspective/widget/static/perspective-anywidget.js\")\n    ) {\n        throw new Error(\n            \"anywidget bundle is not present in perspective/widget/static, please build `@perspective-dev/anywidget`\",\n        );\n    }\n\n    const readme_md = fs.readFileSync(\"./README.md\");\n    const pkg_info = generatePkgInfo(pyproject, cargo, readme_md);\n    fs.writeFileSync(\"./PKG-INFO\", pkg_info);\n\n    // Maturin finds extra license files in the root of the source directory,\n    // then packages them into .dist-info in the wheel.  As of Nov 2024,\n    // Maturin does not yet support explicitly declaring `license-files` in\n    // pyproject.toml.  See https://github.com/PyO3/maturin/pull/862\n    // https://github.com/PyO3/maturin/issues/861\n    const crate_files = glob.sync(Array.from(cargo[\"package\"][\"include\"]));\n    const wheel_dir = `../target/wheels`;\n    fs.mkdirSync(wheel_dir, { recursive: true });\n    await tar.create(\n        {","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-python/build.mjs#L120-L156","documentation":"The python build script requires the anywidget client bundle `perspective/widget/static/perspective-anywidget.js` to exist in the wheel's static assets. It throws because the @perspective-dev/anywidget package output was not built or not copied into perspective/widget/static before this check at build.mjs:138.","triggerScenarios":"Building perspective-python when `perspective/widget/static/perspective-anywidget.js` is absent — i.e. the `@perspective-dev/anywidget` package was not built or its bundle was not copied into the widget static directory.","commonSituations":"Partial monorepo builds skipping the anywidget package; stale node_modules after version bumps; CI jobs building only the python target; cleaning static/ without rebuilding the frontend.","solutions":["Build `@perspective-dev/anywidget` (pnpm build in that package, or run the monorepo-wide build) before building perspective-python","Re-run the full workspace build so anywidget output is generated and copied into perspective/widget/static","Check the build log for a failed or skipped copy step into perspective/widget/static and fix the root failure","If the bundle exists elsewhere, confirm you invoke build.mjs from the correct working directory so the relative path resolves"],"exampleFix":"# before\n$ cd rust/perspective-python && node build.mjs\nError: anywidget bundle is not present in perspective/widget/static...\n// after\n$ pnpm build  # from repo root; includes @perspective-dev/anywidget\n$ cd rust/perspective-python && node build.mjs","handlingStrategy":"validation","validationCode":"if (!require('fs').existsSync('perspective/widget/static/perspective-anywidget.js')) {\n  throw new Error('Build @perspective-dev/anywidget before building perspective-python');\n}","typeGuard":null,"tryCatchPattern":"try { await buildPython(); } catch (e) { if (/anywidget bundle is not present/.test(e.message)) { console.error('Run the @perspective-dev/anywidget build first'); process.exit(1); } throw e; }","preventionTips":["Run the workspace-wide build (pnpm build) before python packaging","Never clean perspective/widget/static without rebuilding anywidget","Verify widget static artifacts in CI before packaging the wheel"],"tags":["build","missing-artifact","anywidget"],"backgroundTag":"file-not-found","analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}