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

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