Support to build dhis

Hello Everyone.
I am new to dhis2, I have been trying to build the dihi2-core using maven but it always stops at DHIS Audit Support with the error message
ailed to load ApplicationContext: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘integrationTestConfig’:
Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name ‘org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration’:
Unsatisfied dependency expressed through method ‘setConfigurers’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:

Please I need assistance in building the application

Best Regards

Hussein Alhassan

Hi @hussein_alhamidi, did you manage to solve this issue?
Also, are you trying to spin up a DHIS2 local instance? Please let us know so we could walk you through the process.

Debora

Hi @debora , Thank you very much for your reply. Yes I have been able to build the dhis2 core. I am not struggling to run the javascript app (maintenance-app).

I will be very glad if you can walk me through the process.

Thanks in advance

Hi @bussey ! Thanks letting me know. Would you mind sharing the specific issues that you’re facing?

@debora , Once again thanks for your reply

The specific issue is a below.
After running the npm command : npm start , I run into the following error.
ERROR in ./src/maintenance.js
Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In C:\Java Practicals\maintenance-app-master\node_modules\babel-preset-react\lib\index.js
at createDescriptor (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:178:11)
at C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:109:50
at Array.map ()
at createDescriptors (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:109:29)
at createPresetDescriptors (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:101:10)
at presets (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:47:19)
at mergeChainOpts (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:416:26)
at C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:374:7
at Generator.next ()
at loadFileChain (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:228:24)
at loadFileChain.next ()
at buildRootChain (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:135:29)
at buildRootChain.next ()
at loadPrivatePartialConfig (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\partial.js:101:62)
at loadPrivatePartialConfig.next ()
at C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\partial.js:140:25
@ multi (webpack)-dev-server/client?http://localhost:8081 ./src/maintenance.js
Child html-webpack-plugin for “index.html”:
[0] ./~/lodash/lodash.js 543 kB {0} [built]
[1] ./~/html-webpack-plugin/lib/loader.js!./index.ejs 1.23 kB {0} [built]
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
webpack: Failed to compile.

Please if there is something I am missing

Thanks

I can’t say that I’ve encountered this problem before. But you can try to use yarn instead of npm. See here on how to install it. After installation you should be able to use yarn install then yarn start.

After you’ve got it running: by default the maintenance-app will connect to the server on localhost:8080. If the server is running somewhere else you will need to create a config.js-file in your DHIS2_HOME directory.
The file should contain something like this:

module.exports = {
    "baseUrl": "https://debug.dhis2.org/dev",
    "authorization": "Basic YWRtaW46ZGlzdHJpY3Q=", // admin:district
}

2 Likes

@birkbjo thanks for your reply, am going to try with yarn and revert.

@birkbjo Hello, please after running the command yarn start, i got the same error as the npm command as below. Please check to see if there is any way you can help me resolve this issue

ERROR in ./src/maintenance.js
Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In C:\Java Practicals\maintenance-app-master\node_modules\babel-preset-react\lib\index.js
at createDescriptor (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:178:11)
at C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:109:50
at Array.map ()
at createDescriptors (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:109:29)
at createPresetDescriptors (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:101:10)
at presets (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-descriptors.js:47:19)
at mergeChainOpts (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:416:26)
at C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:374:7
at Generator.next ()
at loadFileChain (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:228:24)
at loadFileChain.next ()
at buildRootChain (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\config-chain.js:135:29)
at buildRootChain.next ()
at loadPrivatePartialConfig (C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\partial.js:101:62)
at loadPrivatePartialConfig.next ()
at C:\Java Practicals\maintenance-app-master\node_modules@babel\core\lib\config\partial.js:140:25
@ multi (webpack)-dev-server/client?http://localhost:8081 ./src/maintenance.js
Child html-webpack-plugin for “index.html”:
chunk {0} index.html 545 kB [entry] [rendered]
[0] ./~/lodash/lodash.js 543 kB {0} [built]
[1] ./~/html-webpack-plugin/lib/loader.js!./index.ejs 1.23 kB {0} [built]
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
webpack: Failed to compile.

@bussey, did you remove the node_modules-folder before trying with yarn? I’m pretty sure this is due to a wrongly resolved dependency. Try to remove the node_modules folder and try again, or run yarn install --force.

@birkbjo Hello, hope you doing well. Please after removing nod_modules folder, everything seams to work fine, except that after opening the browser, it hangs, when I checked the console, I found this error:

Access to fetch at ‘http://localhost:8080/dhis/api/29/userSettings’ from origin ‘http://localhost:8081’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

Please how do I enable the CORS policy

Thanks in advance

@birkbjo Hope you doing well. Please am still struggling to enable the cors policy. I don’t know where to do that. Please help me out. Thanks in advance

@bussey there are a few things that you can try:

  1. Are you using Chrome? You can try disabling the cache from the network tab in Chrome devtools. Have you tried using Firefox maybe?
  2. Also, you can add the hostname into the CORS whitelist on your local DHIS2 instance. You can add this on System Settings → Access → CORS whitelist.

Please let me know if any of these options helps!