Docker Setup Woes

My current setup (all 3 of them) involves a container via Docker Desktop on Windows. Running the npm install command found in the docs doesn’t work (the likelihood of it being a hardware issue is pretty low, considering the various hardware that all 3 of these containers run on).

The errors tend to be complaints about proxy errors (not behind a proxy), and dropped connections. The truth is that the container is just struggling under the weight of npm doing its thing.

The two workarounds I’ve found:

Seeding the Cache

The goal here is to seed the npm cache, so it doesn’t have to download, extract, and link some of the larger libraries in our dependency tree, which shortcuts enough steps to squeak by before npm just up and dies on us.

  1. Create a completely separate npm project that has no dependencies, it doesn’t matter where.
  2. npm install <lib> where <lib> is one of the larger libraries in the web portal
    1. I prefer @babel/core and ember-cli.
  3. Go back to the ares-webportal directory and run npm i --no-audit --no-fund --prefer-offline (the --prefer-offline flag is the secret sauce here, without it, npm will keep trying to download the package even if it’s in the cache)
    1. If this fails, repeat steps 1 and 2. Eventually you have enough packages that the main install command in step 3 should complete.

As you can see, this is a bit of a whack-a-mole approach, but it gets you there without really having to do any changes to the ares-webportal project itself. It also takes some patience (there are false starts, and npm really does crawl – 20+ minutes just to fail for some attempts in Step 3). You can delete the npm project created in step 1 once you’ve completed step 3 successfully, you don’t need that laying around (the npm cache lives elsewhere).

YARN

Now that the container is on a more modern version of node by default (18), we have a few more options available to us that don’t require a huge overhaul… like no longer using npm, and instead using yarn.

  1. Inside the ares-webportal project
  2. corepack enable
  3. yarn set version stable
    1. Confirm all the things
  4. In the root of the project, create a file named .yarnrc.yml with the following content:

    nodeLinker: “node-modules”
    httpTimeout: 240000

  5. Add the following line to .gitignore:

    .yarn/

  6. yarn

And just let it run. This is a replacement for the npm install --no-audit --no-fund step in the docs. Unfortunately, you are altering the project to make this work (editing one file, adding a new one), but if you’re comfortable navigating those differences, this is an (read: my preferred) option.

Hope this helps.

Sorry that you’ve had troubles with the Docker install and thank you for sharing your workarounds. I wouldn’t suggest using yarn instead of npm, as you can run into some installation troubles when you try to upload that code to the real server.

Unfortunately, there are a lot of OS-specific variations in Docker desktop, and it’s impossible for me to account for them all. There are other VM solutions you can try, but getting them set up is also a pain. Proxy issues are common - not because you are behind a proxy, but because the system is trying to map ports from localhost:port to VM:port.

Fundamentally, the Ares installation is designed to run on a VPS server, with Digital Ocean being the only officially supported environment. While the docker instance does work for some folks, setting up a local install is often going to require some fiddling.

1 Like

Yep! This is mostly meant as a ‘if people run into the same problems I did’ rather than a chunk of suggestions.