Hi all,
I’m encountering build errors during the Upload Test Data section of the Local Setup guide at docs.communityhealthtoolkit.org/building/local-setup/. I’ve followed that documentation, and I am currently running 4.21.0.
Here’s the full context and error output:
salmanfatahillah in Salmans-MacBook-Air in cht-core/config/default on master is 📦 v0.1.0 via v20.16.0
❯ cht --url=https://medic:password@127-0-0-1.local-ip.medicmobile.org:10443/ --accept-self-signed-certs
WARN Project has no dependency on cht-conf.
INFO Checking that https://medic:****@127-0-0-1.local-ip.medicmobile.org:10443/medic/ is available...
(node:50240) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
INFO Processing config in default.
INFO Actions:
- check-git
- compile-app-settings
- backup-app-settings
- upload-app-settings
- convert-app-forms
- convert-collect-forms
- convert-contact-forms
- convert-training-forms
- validate-app-forms
- validate-collect-forms
- validate-contact-forms
- validate-training-forms
- backup-all-forms
- delete-all-forms
- upload-app-forms
- upload-collect-forms
- upload-contact-forms
- upload-training-forms
- upload-resources
- upload-branding
- upload-partners
- upload-custom-translations
- upload-privacy-policies
- upload-extension-libs
- upload-database-indexes
INFO Starting action: check-git…
INFO Fetching git upstream...
INFO check-git complete.
INFO Starting action: compile-app-settings…
WARN app_settings.json file should not be edited directly.
Please create a base_settings.json file in app_settings folder and move any manually defined configurations there.
INFO Packaging contact-summary
INFO assets by status 15.1 KiB [cached] 1 asset
modules by path ../../../../.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/src/contac...(truncated) 3.6 KiB
../../../../.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/src/contact-...(truncated) 203 bytes [built] [code generated]
../../../../.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/src/contact-su...(truncated) 3.41 KiB [built] [code generated]
modules by path ./*.js 31.7 KiB
./contact-summary.templated.js 15.8 KiB [built] [code generated]
./contact-summary-extras.js 15.9 KiB [built] [code generated]
ERROR in ./contact-summary-extras.js 1:15-32
Module not found: Error: Can't resolve 'moment' in '/Users/salmanfatahillah/CHT/cht-core/config/default'
@ ./contact-summary.templated.js 2:15-50
@ ../../../../.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/src/contact-summary/lib.js 1:21-60
ERROR in ./contact-summary.templated.js 1:15-32
Module not found: Error: Can't resolve 'moment' in '/Users/salmanfatahillah/CHT/cht-core/config/default'
@ ../../../../.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/src/contact-summary/lib.js 1:21-60
ERROR in [eslint] Failed to load config "@medic" to extend from.
Referenced from: /Users/salmanfatahillah/CHT/cht-core/config/default/.eslintrc
2 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.100.1 compiled with 3 errors in 405 ms
INFO Error: Webpack errors when building contact-summary
at /Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/src/lib/compilation/package-lib.js:89:23
at finalCallback (/Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:521:32)
at /Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:545:13
at Hook.eval [as callAsync] (eval at create (/Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:20:14)
at onCompiled (/Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:543:21)
at /Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:1377:17
at Hook.eval [as callAsync] (eval at create (/Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:20:14)
at /Users/salmanfatahillah/.nvm/versions/node/v20.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:1373:33
ERROR Webpack errors when building contact-summary
For context, I launched my local CHT instance using this command:
salmanfatahillah in Salmans-MacBook-Air in cht-core/scripts/docker-helper-4.x on master took 4s
❯ ./cht-docker-compose.sh
No project found, follow the prompts to create a project .env file.
Would you like to initialize a new project [y/N]? y
Do you want to run the latest CHT Core version (4.21.0) [Y/n]? Y
How do you want to name the project? reference-app
Downloading compose files ... done
homedir: /Users/salmanfatahillah/.medic/cht-docker/reference_app-dir
[+] Running 2/2
✔ Network reference_app-cht-net Created 0.0s
✔ Container reference_app-dir-cht-upgrade-service-1 Started 0.2s
Starting project "reference_app". First run takes a while. Will try for up to five minutes.......
--------------------------------------------------------
Success! "reference_app" is set up:
https://127-0-0-1.local-ip.medicmobile.org:10443/ (CHT)
https://127-0-0-1.local-ip.medicmobile.org:10443/_utils/ (Fauxton)
Login: medic
Password: password
--------------------------------------------------------
Start existing project
./cht-docker-compose.sh ENV-FILE.env
Stop and keep project:
./cht-docker-compose.sh ENV-FILE.env stop
Stop and destroy all project data:
./cht-docker-compose.sh ENV-FILE.env destroy
https://docs.communityhealthtoolkit.org/hosting/4.x/app-developer/
Have a great day!
The instance itself runs fine, and I’m able to access both the CHT app and Fauxton UI at the expected URLs.
However, it took me quite a while to realize that this part of the documentation:
cht --url=https://medic:password@localhost --accept-self-signed-certs
cht --url=https://medic:password@localhost --accept-self-signed-certs csv-to-docs upload-docs
…actually expects me to replace localhost
with the full local domain generated by the helper script, which in my case is 127-0-0-1.local-ip.medicmobile.org:10443
. I only realised this a few weeks ago.
It would be helpful if the docs clarified this for users who are running via Docker and following the default cht-docker-compose.sh
setup.
Any advice would be appreciated. Happy to share more logs or version details if needed. Thanks in advance!