Error build web-vault patch 2.23.0

Hi,
i’m trying to build vaultwarden using new 2.23.0 patch.
The patch apply cleanly but after npm run dist i get an error:

Step 15/22 : RUN npm run dist
Running in 8b6219599734
bitwarden-web@2.23.0 dist
npm run build:cloud && gulp postdist

bitwarden-web@2.23.0 build:cloud
cross-env NODE_ENV=production ENV=cloud npm run build

bitwarden-web@2.23.0 build
gulp prebuild && webpack -c bitwarden_license/webpack.config.js

[12:15:15] Using gulpfile /vault/gulpfile.js
[12:15:15] Starting ‘prebuild’…
[12:15:15] Starting ‘clean’…
[12:15:15] Finished ‘clean’ after 79 ms
[12:15:15] Starting ‘webfonts’…
[12:15:15] ‘webfonts’ errored after 140 ms
[12:15:15] TypeError: Cannot read property ‘match’ of undefined

  • at formatData (/vault/node_modules/gulp-google-webfonts/index.js:251:20)*
  • at extractData (/vault/node_modules/gulp-google-webfonts/index.js:246:23)*
  • at parseCss (/vault/node_modules/gulp-google-webfonts/index.js:228:19)*
  • at fn (/vault/node_modules/gulp-google-webfonts/node_modules/async/lib/async.js:638:34)*
  • at Immediate. (/vault/node_modules/gulp-google-webfonts/node_modules/async/lib/async.js:554:34)*
  • at processImmediate (internal/timers.js:464:21)*
  • at process.topLevelDomainCallback (domain.js:152:15)*
  • at process.callbackTrampoline (internal/async_hooks.js:128:24)*
    [12:15:15] ‘prebuild’ errored after 231 ms
    The command ‘/bin/sh -c npm run dist’ returned a non-zero code: 1

I’m running Debian 11 and i get the same error both using a local npm/node and running Dockerfile from repository.
I’ve also tried the build on Ubuntu server 21.04 but nothing changes.
My VM has 4 cores and 8GB RAM, so i don’t think it could be an hw problem.

There is another kind of errors in the output log: these errors anyway occurred also building the previous releases and i was able to get the output web-vault archive file, without stopping script execution.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
*npm ERR! *
npm ERR! While resolving: @ngtools/webpack@11.2.13
npm ERR! Found: webpack@4.46.0
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^4.46.0" from the root project
npm ERR! peer webpack@"^4.0.0" from @ngtools/webpack@11.2.13
npm ERR! node_modules/@ngtools/webpack
npm ERR! dev @ngtools/webpack@"^11.2.10" from the root project
npm ERR! 16 more (@webpack-cli/configtest, clean-webpack-plugin, …)
*npm ERR! *
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from @ngtools/webpack@11.2.13
npm ERR! node_modules/@ngtools/webpack
npm ERR! dev @ngtools/webpack@"^11.2.10" from the root project
*npm ERR! *
npm ERR! Conflicting peer dependency: webpack@4.43.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^4.0.0" from @ngtools/webpack@11.2.13
npm ERR! node_modules/@ngtools/webpack
npm ERR! dev @ngtools/webpack@"^11.2.10" from the root project
*npm ERR! *
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
*npm ERR! *
npm ERR! See /home/node/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.npm/_logs/2021-09-30T12_15_09_305Z-debug.log

Any advice?

Thank you very much

Please check the Dockerfile for which commands are executed. I think you are using a wrong npm version. There is a need for a specific version.

Hi again,
i’m not an expert in Dockerfile: i tried to build cloning the whole repo from bw_web_builds without changing anything. I think the statement about npm is:
18: RUN npm -g install npm@7
I don’t know which npm version it could match to.

How can i find npm and node version I need?

Many thanks for the help

That exact line is what you need to run to install v7 of npm.

Excuse me if I’m misunderstanding.
If I do not modify anything (especially Dockerfile) into the whole vw_web_build from https://github.com/dani-garcia/bw_web_builds.git cloning it, shouldn’t the “docker build” provide the correct npm/node packages I need inside the container?

Anyway I’ve just tried with these versions in Debian 11:

  • Node.js: v14.17.4
  • NPM: v7.24.1

getting the same error.

Yet bitwarden web reference reccomends:

  • Node.js v14.17 or greater
  • NPM v7

I don’t understand.

Thank you again

Try remove package-lock.json and run npm install again.

Hi,
I tried removing both packages-lock.json and the whole node_modules directory, then run npm install: the same error occours. A npm chache clean --force didn’t help
I also tried to build using all the node versions >= 14.17 and <15 but no success. The most weird thing is that if I try the build exactly as you find the repo, that is using the Dockerfile I get the same identical error. It should be the way they built the web-vault binary.
I don’t know what could i do more to fix.

Anyway, when i try to build locally (not docker) i’m using node and npm installed from nvm. Could this affect anything?

Thank you

This probably won’t be fixed until we sync to the next upstream release: