Need Help with Running Observable/Framework 1.8 in Offline Environment - Fetch Failed Error

Hi everyone,

I am currently facing an issue with Observable/Framework 1.8 when trying to run it in an environment without internet access. Despite having all the required packages downloaded and brought into the environment, I keep encountering the following error:

fetch failed. error: getaddrinfo enotfound data.jsdelivr.com

It seems like the framework is attempting to fetch something from jsdelivr.com, but since there is no internet connection, it fails.

Has anyone else experienced this issue or have any insights on how to resolve it? Any help or guidance would be greatly appreciated!

Thanks in advance!

Did you build your project before going offline? If not, then some of your npm: prefixed imports may still be uncached:

Downloads from npm are cached in .observablehq/cache/_npm within your source root (typically src ). An imported module is downloaded from jsDelivr only if it is not already in the cache. You can clear the cache and restart the server to re-fetch the latest versions of libraries from npm.

If you installed the package locally via npm then removing the npm: prefix should allow you to import from the local package instead.

My aim is to run develop it in the offline environment. I’m running running it in the observable preview mode, aiming to build it in the same environment as well.

I did install via npm. I’m using sample code that uses only @observablehq/plot. I’m not using the npm: tag

I noticed is that I do have `.observablehq/cache/_node’ folder, but it’s still complaining about packages with npm: prefix

If you want to develop offline, you’ll need to seed your npm import cache (.observablehq/cache/_npm). This is used to self-host any npm: imports, including those used indirectly by the recommended libraries that are available by default in Markdown (such as Plot and d3 and FileAttachment).

The easiest way to seed your npm cache is to build your project (npm run build) once while online, as @mootari mentions. Once your npm cache is seeded, you will be able to rebuild your project offline (as long as you only use the npm: imports that were previously cached).

Building is different from running npm install, which populates node_modules.

Thank you both for your replies and patience.

I got it running. The environment I’m running it on can’t connect online at the moment.

I ended building it on a separate (online) machine and moving the npm cache to the offline one.