YendaNafe CHT PIH Malawi: error Parsing error: The keyword 'const' is reserved

Hi,

I am uploading the YendaNafe CHT app by PIH Malawi and getting the below error:

ERROR in ./contact-summary-extras.js
Module Error (from /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):

/home/ronald/Documents/Github/cht-pih-malawi-app/contact-summary-extras.js
  1:1  error  Parsing error: The keyword 'const' is reserved

βœ– 1 problem (1 error, 0 warnings)

 @ ./contact-summary.templated.js 36:4-39
 @ /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/src/contact-summary/lib.js

ERROR in ./contact-summary.templated.js
Module Error (from /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):

/home/ronald/Documents/Github/cht-pih-malawi-app/contact-summary.templated.js
  1:1  error  Parsing error: The keyword 'const' is reserved

βœ– 1 problem (1 error, 0 warnings)

 @ /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/src/contact-summary/lib.js 1:21-60

ERROR in ./shared.js
Module Error (from /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):

/home/ronald/Documents/Github/cht-pih-malawi-app/shared.js
  1:1  error  Parsing error: The keyword 'const' is reserved

βœ– 1 problem (1 error, 0 warnings)

 @ ./contact-summary-extras.js 24:4-23
 @ ./contact-summary.templated.js
 @ /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/src/contact-summary/lib.js 

INFO Error: Webpack errors when building contact-summary
at /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/src/lib/package-lib.js:96:25
at finalCallback (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:254:12)
at /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:277:6
at done (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/neo-async/async.js:2931:13)
at runCompilers (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:181:48)
at /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:188:7
at /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:270:7
at finalCallback (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:257:39)
at /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:273:13
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), :15:1)
at AsyncSeriesHook.lazyCompileHook (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:154:20)
at onCompiled (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:271:21)
at /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:681:15
at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (/home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:154:20)
at /home/ronald/.nvm/versions/node/v16.16.0/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:678:31

before that error I got:
ERROR No eslint configuration defined please create a .eslintrc file with the desired linting rules

I then copied the .eslint file from the CHT default configuration

Environment

OS Ubuntu 22.04
Docker Using Docker helper script 4.x
CHT Version Version 4.1.0-4.1.0.3674603789 Deployed On Dec 23, 2022

Hi @munjoma

The eslintrc file from default CHT configuration depends on @medic/eslint-config (because it’s extending β€œ@medic”). Can you please try adding and installing this dependency?

1 Like

Hi @diana

Happy New Year and thanks for the pointer.

I don’t know how to install the dependency. As a work around I used a different .eslint file. Out of interest how do I install the dependency? Thanks

Hi @munjoma

You can run npm install @medic/eslint-config. This will add it to your package.json file: cht-pih-malawi-app/package.json at main Β· medic/cht-pih-malawi-app Β· GitHub and it will get installed each time you run npm ci or npm install

2 Likes