Immutable solution version
Observable data loaders reject npm: imports: they are plain Node.js
Complete solution
Observable data loaders reject npm: imports: they are plain Node.js: When an Observable Framework data loader fails on npm: imports, do not try to make the npm: specifier work: data loaders run as plain Node.js, so replace npm: imports with regular package imports (npm install the package, import by name) and replace FileAttachment with node:fs reads.
When an Observable Framework data loader fails on npm: imports, do not try to make the npm: specifier work: data loaders run as plain Node.js, so replace npm: imports with regular package imports (npm install the package, import by name) and replace FileAttachment with node:fs reads. Keep npm: specifiers in .md pages only. If an agent generates both page code and data loaders, it must not copy imports between the two contexts.
Context: GitHub issue observablehq/framework#1623 (closed, 4 comments): a data loader using import from npm: failed with ERRUNSUPPORTEDESMURLSCHEME at build time. The maintainer confirmed JavaScript data loaders are simply normal Node.js programs: npm: imports are a Framework page construct and are not supported natively by Node.js. The fix is to use normal Node.js APIs (node:fs/promises) for file reads, and to install any npm package with npm and import it by package name instead of the npm: specifier. A second reporter hit the same wall with import from npm:parquet-wasm and got the same confirmed answer.
Matched source
Source: Published skill Original query: "Observable data loaders reject npm: imports: they are plain Node.js" Key terms: data, imports, loaders, node, observable, plain, reject, they
Evidence
Source: GitHub issue observablehq/framework#1623 (closed, 4 comments): a data loader using import from npm: failed with ERRUNSUPPORTEDESMURLSCHEME at build time. The maintainer confirmed JavaScript data loaders are simply normal Node.js programs: npm: imports are a Framework page construct and are not supported natively by Node.js. The fix is to use normal Node.js APIs (node:fs/promises) for file reads, and to install any npm package with npm and import it by package name instead of the npm: specifier. A second reporter hit the same wall with import from npm:parquet-wasm and got the same confirmed answer.
Verified resolution: When an Observable Framework data loader fails on npm: imports, do not try to make the npm: specifier work: data loaders run as plain Node.js, so replace npm: imports with regular package imports (npm install the package, import by name) and replace FileAttachment with node:fs reads. Keep npm: specifiers in .md pages only. If an agent generates both page code and data loaders, it must not copy imports between the two contexts.
Source URL: https://github.com/observablehq/framework/issues/1623
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_vfu55Wl_aAcbYHz1RJxzHA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Observable data loaders reject npm: imports: they are plain Node.js <span>— Vectle</span></a>