Error build frontend-app-learner-portal-enterprise

I tried to add the learn-portal-enterprise MFE using tutor-mfe but I get the following error when I run tutor images build mfe.

 > [portal 2/2] RUN sh -c "set -a && source /openedx/env/production && npm run build":
#42 0.687
#42 0.687 > frontend-app-learner-portal-enterprise@0.1.0 build /openedx/app
#42 0.687 > fedx-scripts webpack
#42 0.687
#42 0.772 Running with resolved config:
#42 0.772 /openedx/app/node_modules/@edx/frontend-build/config/webpack.prod.config.js
#42 0.772
#42 104.9 Error parsing bundle asset "/openedx/app/dist/220.9a9604ff35ac8d15e9d9.js": no such file
#42 104.9 Error parsing bundle asset "/openedx/app/dist/app.9b35cc54c74b63d9c939.js": no such file
#42 104.9 Error parsing bundle asset "/openedx/app/dist/runtime.9a013ceb52e81010f297.js": no such file
#42 104.9
#42 104.9 No bundles were parsed. Analyzer will show only original module sizes from stats file.
#42 104.9
#42 105.1 Webpack Bundle Analyzer saved report to /openedx/app/dist/report.html
#42 105.5 assets by status 3.37 MiB [cached] 17 assets
#42 105.5 Entrypoint app = runtime.9a013ceb52e81010f297.js 220.9a9604ff35ac8d15e9d9.js app.9b35cc54c74b63d9c939.css app.9b35cc54c74b63d9c939.js 16 auxiliary assets
#42 105.5 orphan modules 2.87 MiB [orphan] 1365 modules
#42 105.5 runtime modules 4 KiB 10 modules
#42 105.5 built modules 4.2 MiB (javascript) 787 KiB (css/mini-extract) [built]
#42 105.5   modules by path ./node_modules/ 3.75 MiB 741 modules
#42 105.5   modules by path ./src/ 787 KiB (css/mini-extract) 466 KiB (javascript)
#42 105.5     css modules 787 KiB
#42 105.5       modules by path ./src/components/ 1.26 KiB 5 modules
#42 105.5       modules by path ./src/*.scss 786 KiB 2 modules
#42 105.5     javascript modules 466 KiB
#42 105.5       ./src/index.jsx + 183 modules 466 KiB [built] [code generated]
#42 105.5       ./src/components/dashboard/main-content/course-enrollments/course-cards/images/edx-verified-mini-cert.png 39 bytes [built] [code generated] [1 error]
#42 105.5   modules by path ./lib/*./lib/locales (ignored) 30 bytes
#42 105.5     ./lib/locales (ignored) 15 bytes [built] [code generated]
#42 105.5     ./lib/locales (ignored) 15 bytes [built] [code generated]
#42 105.5   ../locale-data/index.js (ignored) 15 bytes [built] [code generated]
#42 105.5
#42 105.5 ERROR in ./src/components/dashboard/main-content/course-enrollments/course-cards/images/edx-verified-mini-cert.png
#42 105.5 Module build failed (from ./node_modules/image-webpack-loader/index.js):

#42 105.5 Error: Cannot find module 'mozjpeg'
#42 105.5 Require stack:
#42 105.5 - /openedx/app/node_modules/imagemin-mozjpeg/index.js
#42 105.5 - /openedx/app/node_modules/image-webpack-loader/index.js
#42 105.5 - /openedx/app/node_modules/loader-runner/lib/loadLoader.js
#42 105.5 - /openedx/app/node_modules/loader-runner/lib/LoaderRunner.js
#42 105.5 - /openedx/app/node_modules/webpack/lib/NormalModuleFactory.js
#42 105.5 - /openedx/app/node_modules/webpack/lib/Compiler.js
#42 105.5 - /openedx/app/node_modules/webpack/lib/webpack.js
#42 105.5 - /openedx/app/node_modules/webpack/lib/index.js
#42 105.5 - /openedx/app/node_modules/webpack-cli/lib/webpack-cli.js
#42 105.5 - /openedx/app/node_modules/webpack-cli/lib/bootstrap.js
#42 105.5 - /openedx/app/node_modules/webpack-cli/bin/cli.js
#42 105.5 - /openedx/app/node_modules/webpack/bin/webpack.js
#42 105.5 - /openedx/app/node_modules/@edx/frontend-build/bin/fedx-scripts.js
#42 105.5     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
#42 105.5     at Function.Module._load (internal/modules/cjs/loader.js:667:27)
#42 105.5     at Module.require (internal/modules/cjs/loader.js:887:19)
#42 105.5     at require (/openedx/app/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
#42 105.5     at Object.<anonymous> (/openedx/app/node_modules/imagemin-mozjpeg/index.js:4:17)
#42 105.5     at Module._compile (/openedx/app/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
#42 105.5     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
#42 105.5     at Module.load (internal/modules/cjs/loader.js:863:32)
#42 105.5     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
#42 105.5     at Module.require (internal/modules/cjs/loader.js:887:19)
#42 105.5  @ ./src/components/dashboard/main-content/course-enrollments/course-cards/CompletedCourseCard.jsx 14:0-65 45:15-29
#42 105.5  @ ./src/components/dashboard/main-content/course-enrollments/course-cards/index.js 1:0-71 1:0-71
#42 105.5  @ ./src/components/dashboard/main-content/course-enrollments/CourseEnrollments.jsx 38:0-120 189:21-41 203:21-39 207:21-40 211:21-44
#42 105.5  @ ./src/components/dashboard/main-content/course-enrollments/index.js 1:0-67 1:0-67
#42 105.5  @ ./src/rootReducer.js 2:0-102 6:21-38
#42 105.5  @ ./src/store.js 7:0-40 13:24-35
#42 105.5  @ ./src/components/app/App.jsx 12:0-32 26:11-16
#42 105.5  @ ./src/components/app/index.js 1:0-39 1:0-39
#42 105.5  @ ./src/index.jsx 9:0-39 13:37-40
#42 105.5
#42 105.5 webpack 5.50.0 compiled with 1 error in 97977 ms
#42 105.7 npm ERR! code ELIFECYCLE
#42 105.7 npm ERR! errno 1
#42 105.7 npm ERR! frontend-app-learner-portal-enterprise@0.1.0 build: `fedx-scripts webpack`
#42 105.7 npm ERR! Exit status 1
#42 105.7 npm ERR!
#42 105.7 npm ERR! Failed at the frontend-app-learner-portal-enterprise@0.1.0 build script.
#42 105.7 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#42 105.7
#42 105.7 npm ERR! A complete log of this run can be found in:
#42 105.7 npm ERR!     /root/.npm/_logs/2021-10-05T16_07_13_129Z-debug.log
------
executor failed running [/bin/sh -c sh -c "set -a && source /openedx/env/production && npm run build"]: exit code: 1

I came across the same issue with a custom MFE and in both cases, the build works locally but fails in the MFE container.

I’m still looking into it but thought I would share in case any knows what the issue is.

1 Like

This is the entry of my config.yml

MFE_PORTAL_MFE_APP:
  name: portal
  port: 8734
  repository: https://github.com/edx/frontend-app-learner-portal-enterprise
  version: master
1 Like

These missing dependencies are typically caused by the fact that we are basing our Docker images on alpine instead of Debian/Ubuntu. Can you please try whether switching to node:12-bullseye-slim resolves your issue? If yes, I propose that we modify the “mfe” base image.

I’ve had to make some change to the first RUN command:

RUN apt-get update && apt-get install -y \
    git \
    # npm package system dependencies
    autoconf \
    automake \
    # build-base \
    libpng-dev \
    pngquant

but I am getting an error with the source command:

[profile 2/2] RUN set -a && source /openedx/env/production && npm run build:
#28 1.365 /bin/sh: 1: source: not found

I had to remove “source” and change the line to:

RUN sh -c "set -a && . /openedx/env/production && npm run build"

And it works :tada: !

I’ll open a draft PR.

Hey Sofiane, sorry that did not remember this earlier, but I already made the switch from alpine to bullseye in the nightly branch: tutor-mfe/Dockerfile at nightly · overhangio/tutor-mfe · GitHub
I guess that if you need this change in master we can backport it.

Ah ok, yeah makes sense to just backport it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.