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:
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.