Production build fail

System Information
  • Strapi Version: 3.2.5
  • Operating System:
  • Database: Mysql
  • Node Version: 12.19.0
  • NPM Version: 6.14.8
  • Yarn Version: 1.22.4

I actually try to pass env variable to the front but the problem is the build fails each time and i tried to relaunch it by SSH, there is the error I get when trying to build (Error that I don’t have on my local environment either in NODE_ENV development/production) :
yarn run v1.22.5
$ strapi build
Building your admin UI with production configuration ...
● Webpack β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ building (48%) 323/373 modules 50 active
babel-loader β€Ί .cache/plugins/strapi-plugin-users-permissions/admin/src/translations/index.js
Error: Module not found: Error: Can't resolve './assets/images/logo.svg' in '/usr/app/.cache/plugins/strapi-plugin-users-permissions/admin/src'

This is typically due to some outdated cached packages

Please delete the following files and folders:

  • .cache
  • build
  • node_modules
  • package-lock.json
  • yarn.lock

Then reinstall your node_modules with npm i or yarn install and rebuild the admin with NODE_ENV=production yarn build or NODE_ENV=production npm run build

1 Like

Thank you for your answer @DMehaffy.
After more search into what makes it doesn’t work is that it seems that the CI process is not well implemented. The .env file generation is called after the admin build which cause the front not to get the proper environment variable values.

I’ll update that and let you know if I still get errors during deployment :slight_smile:

Thomas

1 Like

I am facing same issue. I searched the solution for last 3 days but I am failed to solve. Would you please tell me how you solved?

I am also facing this issue.

I cloned my strapi backend to an EC2 instance, configured MySQL and the DB connection in strapi.

My strapi build command hangs at 92% (sealing, asset processing).

I am on Node v14.20.0 and have tried with both npm install and yarn install, as well as npm run build, yarn build

If your development environment is working then I would try what DMehaffy said above in this thread.

Also, did you remember to set a .env file for your production environment? I have made that mistake when I clone a fresh copy.

Yup, I tried what he said. I also made sure from the start that I had the .env file in place.

Going to try removing MySQL, and using MariaDB. I used MariaDB locally… Not sure if maybe using MySQL instead of MariaDB on the prod server is causing this.

I had the same problem as @muzu above, where it was hanging , or getting really slow to build. It was not dying or throwing any errors though. It did turn out the issue was servers size. I was using t2.micro on AWS and that was too small.

Once I moved to a t2.medium build happens reasonably quickly.

1 Like

Thank you a lot @muzu, upgrading instance type solved my issue