Unable to push and upload a Blank Project on my local environment

I am following this [tutorial] (Getting started building a CHT app | Community Health Toolkit) to set up my local instance.
I was initially unable to initialize the project with

cht initialise-project-layout

command. The package.json file was not initially created.
The cht initialise-project-layout command worked on another directory, and I manually copied the package.json into the directory as directed in the tutorial.
When I run

cht --url=https://medic:password@localhost --accept-self-signed-certs

I get the ‘ERROR Error: Webpack warnings when building contact-summary’

npm ci does not resolve this.
I am on ubuntu 22.04 and my node version is v16.14.0

How can I resolve this?

Hi @Philip_Mwago, welcome to the CHT forum.
Could you please try running npm init before calling cht initialise-project-layout command and see if creates the package.json file and resolves the issue?

Hi @niraj I had manually copied the package.json file from another directory. The

cht initialise-project-layout runs but throws the following error: ERROR Require exactly one of these parameter: --local --instance --url --archive.

cht init did not resolve this.

When I run

cht --url=https://medic:password@localhost --accept-self-signed-certs

I get the ‘ERROR Webpack warnings when building contact-summary’

thanks @Philip_Mwago , not sure what might be the issue, would it be possible to add full log for the error? Also, did you try running npm install after copying package.json file to install dependencies?

@Philip_Mwago could you please paste the contents of the full error / stack trace?

root@phil:~/cht-local-setup/upgrade/cht-core/config/default/cht-app-tutorials# cht --url=https://medic:password@localhost --accept-self-signed-certs

INFO Checking that https://medic:****@localhost/medic/ is available…
(node:10023) 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 cht-app-tutorials.
INFO Actions:
- check-git
- compile-app-settings
- backup-app-settings
- upload-app-settings
- convert-app-forms
- convert-collect-forms
- convert-contact-forms
- validate-app-forms
- validate-collect-forms
- validate-contact-forms
- backup-all-forms
- delete-all-forms
- upload-app-forms
- upload-collect-forms
- upload-contact-forms
- upload-resources
- upload-branding
- upload-partners
- upload-custom-translations
- upload-privacy-policies
INFO Starting action: check-git…
INFO No production environment detected: skipping check-git…
INFO check-git complete.
INFO Starting action: compile-app-settings…
INFO Packaging contact-summary
INFO Hash: 6e6c791061e1f222b98f
Version: webpack 4.46.0
Child
Hash: 6e6c791061e1f222b98f
Time: 1189ms
Built at: 01/27/2023 5:53:32 PM
Asset Size Chunks Chunk Names
./contact-summary.js 2.77 KiB 0 main
Entrypoint main = ./contact-summary.js
[0] /usr/local/lib/node_modules/cht-conf/src/contact-summary/lib.js 203 bytes {0} [built]
[1] ./contact-summary.templated.js 62 bytes {0} [built] [1 error]
[2] /usr/local/lib/node_modules/cht-conf/src/contact-summary/contact-summary-emitter.js 3.41 KiB {0} [built]

ERROR in ./contact-summary.templated.js
Module Error (from /usr/local/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):

/root/cht-local-setup/upgrade/cht-core/config/default/cht-app-tutorials/contact-summary.templated.js
  5:3  error  Newline required at end of file but not found  eol-last

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

 @ /usr/local/lib/node_modules/cht-conf/src/contact-summary/lib.js 1:21-60 

INFO Error: Webpack errors when building contact-summary
at /usr/local/lib/node_modules/cht-conf/src/lib/package-lib.js:96:25
at finalCallback (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:254:12)
at /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 /usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:188:7
at /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 /usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:273:13
at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), :15:1)
at AsyncSeriesHook.lazyCompileHook (/usr/local/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:154:20)
at onCompiled (/usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:271:21)
at /usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:681:15
at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (/usr/local/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:154:20)
at /usr/local/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:678:31
ERROR Webpack errors when building contact-summary

Hi team, I’m also stuck at this point where I get the error

‘ERROR Error: Webpack warnings when building contact-summary’

when trying to upload a blank project.

I have tried to update the dependencies but getting back to an endless loop

Hi @Itskiprotich , I was able to push a new blank project on my local setup by creating a different directory (mkdir) on another location outside the cht-core location.
Clear your browser cache, and it should work. You can proceed to customize your local environment per your requirements, e.g. branding.
If the cht initialise-project-layout command does not create the package.json file, try running npm init before calling cht initialise-project-layout command

@Esther_Moturi I was able to replicate this error with some teammates per the instructions on this tutorial. I will propose the changes.

1 Like

Thanks, @Philip_Mwago. I can now upload a blank project.

2 Likes

The tutorial has been updated.