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.
- Create a completely separate npm project that has no dependencies, it doesn’t matter where.
npm install <lib>
where<lib>
is one of the larger libraries in the web portal- I prefer
@babel/core
andember-cli
.
- I prefer
- 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)- 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.
- Inside the ares-webportal project
corepack enable
yarn set version stable
- Confirm all the things
- In the root of the project, create a file named .yarnrc.yml with the following content:
nodeLinker: “node-modules”
httpTimeout: 240000 - Add the following line to .gitignore:
.yarn/
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.