Strapi build error

Yesterday I tried to update to Strapi 4.13.1 and today to 4.13.2: Both build tries ended with an error:

Build Assets 20230906082433697
Env path /home/cleavr/cms.example.com/releases/20230906082433697/.env is already linked to /home/cleavr/cms.example.com/.env
Building the assets using npm run build --production ...
npm WARN config production Use `--omit=dev` instead.

> woka-cms-5-mysql@1.0.0 build
> strapi build

Building your admin UI with production configuration...
ℹ Compiling Webpack
ModuleNotFoundError: Module not found: Error: Can't resolve 'react-dom/client' in '/home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/src'
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/Compilation.js:2022:28
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:817:13
    at eval (eval at create (/home/cleavr/cms.example.com/releases/20230906082433697/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:275:22
    at eval (eval at create (/home/cleavr/cms.example.com/releases/20230906082433697/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:448:22
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:118:11
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:689:25
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:893:8
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:1013:5
resolve 'react-dom/client' in '/home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/src'
  Parsed request is a module
  using description file: /home/cleavr/cms.example.com/releases/20230906082433697/.cache/package.json (relative path: ./admin/src)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/src/node_modules doesn't exist or is not a directory
      /home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/node_modules doesn't exist or is not a directory
      /home/cleavr/cms.example.com/releases/20230906082433697/.cache/node_modules doesn't exist or is not a directory
      looking for modules in /home/cleavr/cms.example.com/releases/20230906082433697/node_modules
        existing directory /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom
          using description file: /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/package.json (relative path: .)
            using description file: /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/package.json (relative path: ./client)
              no extension
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client doesn't exist
              .js
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.js doesn't exist
              .jsx
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.jsx doesn't exist
              .react.js
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.react.js doesn't exist
              .ts
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.ts doesn't exist
              .tsx
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.tsx doesn't exist
              as directory
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client doesn't exist
      /home/cleavr/cms.example.com/releases/node_modules doesn't exist or is not a directory
      /home/cleavr/cms.example.com/node_modules doesn't exist or is not a directory
      /home/cleavr/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'react-dom/client' in '/home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/src'
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/Compilation.js:2022:28
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:817:13
    at eval (eval at create (/home/cleavr/cms.example.com/releases/20230906082433697/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:275:22
    at eval (eval at create (/home/cleavr/cms.example.com/releases/20230906082433697/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:448:22
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:118:11
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:689:25
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:893:8
    at /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/webpack/lib/NormalModuleFactory.js:1013:5
resolve 'react-dom/client' in '/home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/src'
  Parsed request is a module
  using description file: /home/cleavr/cms.example.com/releases/20230906082433697/.cache/package.json (relative path: ./admin/src)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/src/node_modules doesn't exist or is not a directory
      /home/cleavr/cms.example.com/releases/20230906082433697/.cache/admin/node_modules doesn't exist or is not a directory
      /home/cleavr/cms.example.com/releases/20230906082433697/.cache/node_modules doesn't exist or is not a directory
      looking for modules in /home/cleavr/cms.example.com/releases/20230906082433697/node_modules
        existing directory /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom
          using description file: /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/package.json (relative path: .)
            using description file: /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/package.json (relative path: ./client)
              no extension
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client doesn't exist
              .js
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.js doesn't exist
              .jsx
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.jsx doesn't exist
              .react.js
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.react.js doesn't exist
              .ts
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.ts doesn't exist
              .tsx
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client.tsx doesn't exist
              as directory
                /home/cleavr/cms.example.com/releases/20230906082433697/node_modules/react-dom/client doesn't exist
      /home/cleavr/cms.example.com/releases/node_modules doesn't exist or is not a directory
      /home/cleavr/cms.example.com/node_modules doesn't exist or is not a directory
      /home/cleavr/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory

Waht can I do?
Thanks Roman

Hello Roman,

Can you try running Strapi in your local environment by running npm run build --production and let us know the response you get?

Because my local (dev-)build now also failed, I “reseted” my local installation by deleting .cache- and node-modules-folders and the package-lock.json file. I also read that someone helped to install the design-system, so I also did npm i @strapi/design-system. Then the build worked. I commited and pushed to git, and now the deployment worked.

Thanks Roman

2 Likes