Docker Install - Can't find module error

My System:

lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble

uname -a
Linux gpu-ubuntu 6.8.0-49-generic #49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 4 02:06:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

docker -v
Docker version 27.3.1, build ce12230

docker compose version
Docker Compose version v2.29.7

nvm --version
0.40.0

node --version
v20.18.1

Commands ran from git clone folder bolt.new-any-llm:
docker build . --target bolt-ai-development
docker compose --profile development up

Then I get the error when going to the web interface. This happens on everyone of my computers.

I have never attempted yet to use the npm run dockerbuild. I just did and the application actually lets me open the web page. But alas still doesn’t work. The .env variable isn’t working right. I have the API key for OpenAI in and can chat with OpenAI but no code generation. It doesn’t see my Ollama at all. I can go to localhost:11434 or IP:11434 and Ollama is running. In fact I am running Open-WebUI and other tools using Ollama and they work fine.

The error message in the code window is:
Failed to spawn bolt shell

Worker.postMessage: The WebAssembly.Memory object cannot be serialized. The Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP headers can be used to enable this.

My windows VM is isolated from the internet and thus I have my Google Chrome setting set to low security. However, you can also try using the suggestion below to find the correct setting that needs to be set. “Configuring your browser to run WebContainers | StackBlitz DocsConfiguring your browser to run WebContainers

While all supported browsers can run WebContainers, some browser options can stop WebContainers from running correctly.

You can work around those issues by adding exceptions for StackBlitz domains in your browser’s settings. Here’s how.

Why do I need to add exceptions for StackBlitz?

WebContainers use a combination of browser technologies, such as Service Worker and WebAssembly, across several domains. Each running project has its own domain and needs to install a Service Worker for that domain to work properly.

In some browsers, this feature is blocked by “third-party cookie” or “third-party storage” restrictions. These are legitimate restrictions when the third-party domain is an ad server or a tracking server, but in the case of WebContainers the third-party domain is where your project code runs.

Chrome

With Chrome’s defaults, starting with version 118 or later, you should get a pretty good experience out of the box.

Read on if you run into issues or want an even smoother experience.

Previews in a separate tab

Previews opened in a separate tab are not connected by default to the editor and require an extra step. To complete this step, you are usually prompted to click a button.

This can happen automatically if your popups settings, chrome://settings/content/popups, are adjusted with the following exception:

https://[*.]webcontainer.io

Once done, whenever the preview needs to reconnect to the editor, it will open a popup that gets immediately closed.

Lastly, if Chrome’s memory saver is turned on, this step might be necessary more often than required. To avoid it, you can add the following exception in chrome://settings/performance:

Your performance settings should be similar to this:

Enabling Service Workers

If you use the “Block Third Party Cookies” option in Chrome and you have “Third-party Storage Partitioning” disabled, you will need to either:

  • Enable Storage partitioning
  • Or add exceptions for StackBlitz projects.

The first option should be preferred because this is a new feature of Chrome which improves your privacy when you visit websites that embed third-party sites.

Enable Storage partitioning

Visit chrome://flags/#third-party-storage-partitioning and choose Enabled in the drop down. In recent version of Chrome, choosing the Default value should work too.

Or add exceptions for Stackblitz

To allow all StackBlitz projects to use Service Workers, go to your browser’s cookie preferences, and add exceptions for the following URL patterns:

https://[*.]stackblitz.io

https://[*.]webcontainer.io

For instance, in Chrome, go to chrome://settings/cookies and add those exceptions in the “Sites that can always use cookies” section.

Advanced: enabling Service Workers for a single project

Firefox

Enabling Service Workers

When Firefox’s Enhanced Tracking Protection is configured in “Custom” mode with the cookie blocking option set to “All cross-site cookies”, Firefox will block the Service Workers used by WebContainers.

You can work around this issue in a couple ways:

  1. Use the “Strict” mode instead of “Custom” mode. It’s important to note that it’s slightly more permissive than “Custom” mode with very strict options. If this is not something you’d like to allow, you can…
  2. Add exceptions to cookie blocking for the domains used to run StackBlitz projects.

To do so, visit about:preferences#privacy to check what your current settings look like.

To add exceptions for StackBlitz, scroll down to the “Cookies and Site Data” section, click on “Manage Exceptions…”, and add exceptions for the following sites:

Don’t forget to click “Save Changes”. Then you should be able to reload the tab with your StackBlitz project, and hopefully everything should work!

Previews in a separate tab

Previews opened in a separate tab are not connected by default to the editor and require an extra step. To complete this step, you are usually prompted to click a button.

This can happen automatically if your popups settings, about:preferences#privacy, are adjusted with the following exception:

Brave: enabling Service Workers

By default, Brave’s “Shields” feature blocks Service Workers and cookies from third-party domains.

To allow WebContainers to run in Brave, you will need to add an exception for StackBlitz:

  1. Visit a WebContainers-based project, for instance Nextjs - StackBlitz. The project’s boot sequence might stay stuck on the “Running start command” step:

  2. Click on the “Shields” icon at the right of the address bar, then click on “Advanced View”.

  3. In the advanced view, change the “Cross-site cookies blocked” option to “All cookies allowed”.

Brave will reload the page, and you should get a working project:

Edge: enabling WebAssembly

Microsoft Edge disables usage of WebAssembly when you set its “Enhance your security on the web” option to “Strict”.

To allow StackBlitz projects to run, either set this option to “Balanced” or add exceptions for a couple domains used by StackBlitz projects.

  1. Go to edge://settings/privacy → “Enhance your security on the web”.

  2. Then click “Exceptions”, and add exceptions for the following domains:

[*.]staticblitz.com