Webpack error when trying to run cht command for config

Hello everyone! We customized the contact forms to add an image section in the add user interface. While running the cht --url=https://medic:password@localhost --accept-self-signed-certs command on ubuntu, we are getting an error message addressing the webpack warnings. We tried everything to try and solve the issue. Removing the node modules and reinstalling the dependencies didn’t help either. Any suggestions would be helpful.

/contact-summary.js  68 KiB       0  [emitted]  main
    Entrypoint main = ./contact-summary.js
    [0] ./node_modules/moment/moment.js 147 KiB {0} [built]
    [1] /usr/local/lib/node_modules/cht-conf/src/contact-summary/lib.js 203 bytes {0} [built]
    [2] ./contact-summary.templated.js 15.8 KiB {0} [built] [1 warning]
    [3] (webpack)/buildin/module.js 497 bytes {0} [built]
    [4] ./contact-summary-extras.js 15.9 KiB {0} [built] [1 warning]
    [5] /usr/local/lib/node_modules/cht-conf/src/contact-summary/contact-summary-emitter.js 3.41 KiB {0} [built]
    
    WARNING in ./contact-summary.templated.js
    Module Warning (from /usr/local/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):
    Failed to load config "@medic" to extend from.
    Referenced from: /home/ubuntu/cht-core/.eslintrc
     @ /usr/local/lib/node_modules/cht-conf/src/contact-summary/lib.js 1:21-60
    
    WARNING in ./contact-summary-extras.js
    Module Warning (from /usr/local/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):
    Failed to load config "@medic" to extend from.
    Referenced from: /home/ubuntu/cht-core/.eslintrc
     @ ./contact-summary.templated.js 2:15-50
     @ /usr/local/lib/node_modules/cht-conf/src/contact-summary/lib.js 
ERROR Error: Webpack warnings when building contact-summary
    at compiler.run (/usr/local/lib/node_modules/cht-conf/src/lib/package-lib.js:103:23)
    at finalCallback (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:254:12)
    at runWithDependencies.err (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:277:6)
    at done (/usr/local/lib/node_modules/cht-conf/node_modules/neo-async/async.js:2931:13)
    at runCompilers (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:181:48)
    at err (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:188:7)
    at compiler.run (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:270:7)
    at finalCallback (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:257:39)
    at hooks.done.callAsync.err (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:306:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/usr/local/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:154:20)
    at emitRecords.err (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:304:22)
    at Compiler.emitRecords (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:499:39)
    at emitAssets.err (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:298:10)
    at hooks.afterEmit.callAsync.err (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:485:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
1 Like

It looks like it is having trouble loading the Medic ESlint config. Do you have the @medic/eslint-config package listed in your devDependencies?

2 Likes

Thank you @jkuester. We have disabled the warning by putting debug mode for now. We will check in on this as well.

Hello @jkuester , I am interested in this topic as I am facing the same problem at the moment. And yes I have @medic/eslint-config package listed in my devDependencies, I need your assistance.

Hello @gaarimasharma , How do I put debug mode?

Could you please try running cht command by adding --debug? For e.g.


cht --url=https://<username>:<password>@localhost --accept-self-signed-certs compile-app-settings upload-app-settings --debug

I still get the same error.

Hey @Stephen_Mhuli - looking at the local setup guide I see it has you install dependencies, have you run npm ci in the /home/ubuntu/cht-core directory?

As well, can you confirm which version of Node and NPM you’re running with node -v&&npm -v? For reference, for me this shows:

node -v&&npm -v
v12.22.12
6.14.16
2 Likes

Thank you @mrjones now it works , I ran npm ci and restarted docker compose.

It is great to know that the issue is now resolved. I had made error earlier. For reference, the correct way to indicate debug mode is using -- --debug.
i.e.
cht --url=https://<username>:<password>@localhost --accept-self-signed-certs compile-app-settings upload-app-settings -- --debug

2 Likes

I had the same issue when compiling and uploading app settings.
Took me a while to find this conversion but the suggestions helped solve the issue.
So I basically followed the steps below:

  1. Added dev dependency: npm i --save-dev @medic/eslint-config
  2. Ran npm ci in my project home directory
  3. Restarted docker
  4. Ran cht --url=https://<username>:<password>@localhost --accept-self-signed-certs compile-app-settings upload-app-settings

It worked without need for debug mode.

My Environment:

node -v && npm -v
v18.16.0
9.5.1

cht-conf v3.18.3
cht v4.3.1

2 Likes