docker compose - `Failed to lookup view! Did you run ./nodebb build?` error
-
I'm trying to run NodeBB 4.x using Docker, and I'm encountering a strange error in the browser:
Does anyone understand what I'm missing?
Thanks!My docker-compose.yml:
services: forum: image: ghcr.io/nodebb/nodebb:4.x depends_on: - mongo restart: unless-stopped ports: - 80:80 environment: - NODE_ENV=production volumes: - forum-uploads:/usr/src/app/public/uploads - forum-build:/usr/src/app/build - ./apps/forum/config.json:/opt/config/config.json:ro mongo: image: mongo:7.0 restart: unless-stopped environment: - MONGO_INITDB_ROOT_USERNAME=admin - MONGO_INITDB_ROOT_PASSWORD=admin - MONGO_INITDB_DATABASE=admin volumes: - ./mongo/data:/data/db - ./mongo/config:/data/configdb - ./mongo/logs:/var/log/mongodb volumes: forum-uploads: driver: local driver_opts: o: bind type: none device: ./apps/forum/data/uploads forum-build: driver: local driver_opts: o: bind type: none device: ./apps/forum/data/build
./apps/forum/config.json:
{ "url": "https://forum.com", "port": "80", "secret": "**********", "database": "mongo", "mongo": { "host": "mongo", "port": 27017, "username": "forum", "password": "*****", "database": "forum" } }
-
S support@community.nodebb.org shared this topic
-
Even when i set (after looking at https://github.com/NodeBB/NodeBB/blob/master/install/docker/entrypoint.sh) :
environment: - NODE_ENV=production - START_BUILD=true - admin:username=admin - admin:password=yourSecurePassword - admin:password:confirm=yourSecurePassword - admin:email=admin@example.com
I see build in docker log:
up to date, audited 894 packages in 2s 117 packages are looking for funding run `npm fund` for details 1 moderate severity vulnerability Some issues need review, and may require choosing a different dependency. Run `npm audit` for details. npm notice npm notice New major version of npm available! 10.9.2 -> 11.2.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.2.0 npm notice To update run: npm install -g npm@11.2.0 npm notice DEBUG: PACKAGE_MANAGER: npm DEBUG: CONFIG location: /opt/config/config.json DEBUG: START_BUILD: true cat: /opt/config/install_hash.md5: No such file or directory Build before start is enabled. Building... started 2025-03-21T03:48:22.148Z [80/33] - info: [build] Building in parallel mode 2025-03-21T03:48:22.148Z [80/33] - info: [build] plugin static dirs build started 2025-03-21T03:48:22.149Z [80/33] - info: [build] requirejs modules build started 2025-03-21T03:48:22.149Z [80/33] - info: [build] client js bundle build started 2025-03-21T03:48:22.149Z [80/33] - info: [build] admin js bundle build started 2025-03-21T03:48:22.150Z [80/33] - info: [build] client side styles build started 2025-03-21T03:48:22.150Z [80/33] - info: [build] admin control panel styles build started 2025-03-21T03:48:22.150Z [80/33] - info: [build] templates build started 2025-03-21T03:48:22.150Z [80/33] - info: [build] languages build started 2025-03-21T03:48:22.852Z [80/33] - info: [build] client js bundle build completed in 0.703sec 2025-03-21T03:48:22.893Z [80/33] - info: [build] admin js bundle build completed in 0.744sec 2025-03-21T03:48:23.308Z [80/33] - info: [build] plugin static dirs build completed in 1.16sec WARNING: Importing mixins via the fontsource package is deprecated and will be removed in the next major release. Please use the @fontsource-utils/scss package instead. @fontsource/inter/scss/mixins.scss 37:3 generator() @fontsource/inter/scss/mixins.scss 168:3 faces() ../../../../public/scss/admin/fonts.scss 7:1 @import admin/admin.scss 1:9 @import - 11:9 root stylesheet WARNING: Importing mixins via the fontsource package is deprecated and will be removed in the next major release. Please use the @fontsource-utils/scss package instead. @fontsource/poppins/scss/mixins.scss 37:3 generator() @fontsource/poppins/scss/mixins.scss 168:3 faces() ../../../../public/scss/admin/fonts.scss 13:1 @import admin/admin.scss 1:9 @import - 11:9 root stylesheet 2025-03-21T03:48:24.305Z [80/33] - warn: [meta/templates] Partial not loaded: partials/breadcrumbs.tpl 2025-03-21T03:48:24.305Z [80/33] - warn: [meta/templates] Partial not loaded: partials/breadcrumbs.tpl 2025-03-21T03:48:24.306Z [80/33] - warn: [meta/templates] Partial not loaded: partials/paginator.tpl 2025-03-21T03:48:25.333Z [80/33] - info: [build] languages build completed in 3.183sec 2025-03-21T03:48:25.337Z [80/33] - info: [build] requirejs modules build completed in 3.188sec 2025-03-21T03:48:25.338Z [80/33] - info: [build] Bundling with Webpack. 2025-03-21T03:48:25.451Z [80/33] - warn: [meta/templates] Partial not loaded: partials/paginator.tpl [G[1%] setup (before run) [G[1%] setup (before run NodeEnvironmentPlugin) [G[1%] setup (before run) [G[2%] setup (run) [G[4%] setup (normal module factory) [G[5%] setup (context module factory) [G[6%] setup (before compile) [G[6%] setup (before compile ProgressPlugin) [G[6%] setup (before compile) [G[7%] setup (compile) [G[7%] setup (compile ExternalsPlugin) [G[7%] setup (compile) [G[8%] setup (compilation) [G[8%] setup (compilation ArrayPushCallbackChunkFormatPlugin) [G[8%] setup (compilation JsonpChunkLoadingPlugin) [G[8%] setup (compilation StartupChunkDependenciesPlugin) [G[8%] setup (compilation ImportScriptsChunkLoadingPlugin) ... ... [G[92%] sealing (asset processing) [G[93%] sealing (after asset optimization) [G[94%] sealing (after seal) [GBuild finished at 03:48:30 by 0.000s [GBuild finished at 03:48:30 by 0.000s [GBuild finished at 03:48:30 by 0.000s [GBuild finished at 03:48:30 by 0.000s [GBuild finished at 03:48:30 by 0.000s [G282 assets 732 modules ERROR in ./build/public/src/modules/topicThumbs.js 104:6-106:8 Module not found: Error: Can't resolve 'composer' in '/usr/src/app/build/public/src/modules' webpack 5.98.0 compiled with 1 error in 4452 ms 2025-03-21T03:48:30.474Z [80/33] - info: [build] Asset compilation successful. Completed in 8.323sec. > nodebb@4.2.0 start > node loader.js --config=/opt/config/config.json --no-silent --no-daemon NodeBB v4.2.0 Copyright (C) 2013-2025 NodeBB Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. For the full license, please visit: http://www.gnu.org/copyleft/gpl.html Clustering enabled: Spinning up 1 process(es). 2025-03-21T03:48:30.918Z [80/248] - info: Initializing NodeBB v4.2.0 https://forum.com 2025-03-21T03:48:31.738Z [80/248] - info: [socket.io] Restricting access to origin: https://forum.com:* 2025-03-21T03:48:31.776Z [80/248] - info: [api] Adding 0 route(s) to `api/v3/plugins` 2025-03-21T03:48:31.787Z [80/248] - info: [router] Routes added 2025-03-21T03:48:31.791Z [80/248] - info: 🎉 NodeBB Ready 2025-03-21T03:48:31.792Z [80/248] - info: Using ports 80 and 443 is not recommend; use a proxy instead. See README.md 2025-03-21T03:48:31.793Z [80/248] - info: 📡 NodeBB is now listening on: 0.0.0.0:80 2025-03-21T03:48:31.793Z [80/248] - info: 🔗 Canonical URL: https://forum.com
But in the browser there is still error:
Internal server error. Failed to lookup view! Did you run `./nodebb build`?
-
Did you check if the built files are in
/usr/src/app/build
? -
@baris Yes
➜ devops git:(main) ✗ docker compose exec forum ls /usr/src/app/build active_plugins.json cache-buster public ➜ devops git:(main) ✗ docker compose exec forum ls /usr/src/app/build/public admin-rtl.css admin.css client-rtl.css client.css fontawesome language plugins scripts-admin.js scripts-client.js src templates ➜ devops git:(main) ✗
-
What about the template files inside
/usr/src/app/build/public/templates
? The error message you are seeing is caused when expressjs can't find the template file to render. -
@baris It looks like they are in place
➜ devops git:(main) ✗ docker compose exec forum ls /usr/src/app/build/public/templates 400.js 404.tpl admin confirm.js ip-blacklist.js outgoing.js register.js reset.tpl tos.js 400.tpl 500.js chat.js confirm.tpl ip-blacklist.tpl outgoing.tpl register.tpl reset_code.js tos.tpl 403.js 500.tpl chat.tpl emails login.js partials registerComplete.js reset_code.tpl unsubscribe.js 403.tpl 503.js chats.js flags login.tpl post-queue.js registerComplete.tpl sitemap.js unsubscribe.tpl 404.js 503.tpl chats.tpl install modals post-queue.tpl reset.js sitemap.tpl
-
Ok so it looks like you are missing the templates from the theme, this can happen if you don't have a theme activated. For example I don't see the
categories.tpl
file in your output. Make surenodebb-theme-harmony
is activated before./nodebb build
is run.ERROR in ./build/public/src/modules/topicThumbs.js 104:6-106:8 Module not found: Error: Can't resolve 'composer' in '/usr/src/app/build/public/src/modules'
Looks like nodebb-plugin-composer-default is also not activated.
-
@baris Thanks that helps:
docker compose exec forum /usr/src/app/nodebb activate nodebb-plugin-composer-default --config /opt/config/config.json docker compose exec forum /usr/src/app/nodebb activate nodebb-theme-harmony --config /opt/config/config.json
But this is a completely fresh install, shouldn't the forum boot from the as-is official docker image?
-
@baris i can't login :think:
There is no errors in the server log\browser devtools...added 2 packages, and audited 894 packages in 1s 117 packages are looking for funding run `npm fund` for details 1 moderate severity vulnerability Some issues need review, and may require choosing a different dependency. Run `npm audit` for details. npm notice npm notice New major version of npm available! 10.9.2 -> 11.2.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.2.0 npm notice To update run: npm install -g npm@11.2.0 npm notice DEBUG: PACKAGE_MANAGER: npm DEBUG: CONFIG location: /opt/config/config.json DEBUG: START_BUILD: false No changes in package.json. Skipping build... > nodebb@4.2.0 start > node loader.js --config=/opt/config/config.json --no-silent --no-daemon NodeBB v4.2.0 Copyright (C) 2013-2025 NodeBB Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. For the full license, please visit: http://www.gnu.org/copyleft/gpl.html Clustering enabled: Spinning up 1 process(es). 2025-03-22T18:54:35.811Z [4567/56] - info: Initializing NodeBB v4.2.0 http://localhost:4567 2025-03-22T18:54:36.409Z [4567/56] - info: [socket.io] Restricting access to origin: http://localhost:* 2025-03-22T18:54:36.443Z [4567/56] - info: [api] Adding 0 route(s) to `api/v3/plugins` 2025-03-22T18:54:36.448Z [4567/56] - info: [router] Routes added 2025-03-22T18:54:36.455Z [4567/56] - info: 🎉 NodeBB Ready 2025-03-22T18:54:36.456Z [4567/56] - info: 🤝 Enabling 'trust proxy' 2025-03-22T18:54:36.457Z [4567/56] - info: 📡 NodeBB is now listening on: 0.0.0.0:4567 2025-03-22T18:54:36.457Z [4567/56] - info: 🔗 Canonical URL: http://localhost:4567
-
When ./nodebb setup is executed it enables all the default plugins. Including harmony theme and composer default.
Not sure where that happens in the docker file :think: -
@baris Its actually in this bash file: https://github.com/NodeBB/NodeBB/blob/master/install/docker/entrypoint.sh
-
https://github.com/NodeBB/NodeBB/blob/master/install/docker/entrypoint.sh#L186-L188
Should i manually set the envSETUP
?
@baris Doesn't https://manage.nodebb.org uses container-based technology? -
@josef this is the part that should triggered the setup. We don't use docker on manage.nodebb.org.