Error when Setting up Dev Environment Ubuntu 18.04

Hello! I’m following the instructions from the wiki: https://bahmni.atlassian.net/wiki/spaces/BAH/pages/32604585/Setting+up+Bahmni+Dev+Environment

I have everything installed (I think) and now I’m ready to “Prepare and Build Bahmni EMR UI”

When I run:

`# Go into the UI directory’

cd openmrs-module-bahmniapps /ui

# Install node dependencies (Installed into node_modules).

npm install

I get the following error:

> jpegtran-bin@0.1.7 postinstall /home/schadmin/Projects/bahmni/openmrs-module-bahmniapps/ui/node_modules/jpegtran-bin
> node pre-build.js

fs.js:35
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:35:5
    at req_ (/home/schadmin/Projects/bahmni/openmrs-module-bahmniapps/ui/node_modules    /natives/index.js:143:24)
    at Object.req [as require] (/home/schadmin/Projects/bahmni/openmrs-module-bahmniapps/ui/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/home/schadmin/Projects/bahmni/openmrs-module-bahmniapps/ui/node_modules/fstream/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jpegtran-bin@0.1.7 postinstall: `node pre-build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jpegtran-bin@0.1.7 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/schadmin/.npm/_logs/2020-03-06T03_57_35_785Z-debug.log

I’m stuck!

I think I may have puzzled this out. The package.json file has under devDependencies:

"grunt-contrib-imagemin": "~0.1.2",

from the logs it looks like this pacakge is dependnt on jpegtran-bin@0.1.7

Looking up this package I found this page:

www.npmjs.com/package/grunt-contrib-imagemin/v/3.1.0

This shows that version 0.1.2 is 7 years old. Changing that dependency to

"grunt-contrib-imagemin": "~2.0.0",

solved the problem. ~3.0.0 didn’t work fyi. too new I guess.

Perhaps someone who is a contributor can let me know if that change is appropriate or a different version would be more compatible.

2 Likes

Thanks @soddoadam for coming up with the solution. Will test this out. Would you mind raising PR to bahmniapps repo if this fixes the issue. Thanks !

Great! Had the same issue here on MacOS Catalina. Changing the dep does solve the issue.

Thanks @soddoadam for sharing this.

(cc @zouchine)

I submitted a pull request to the repo.

https://github.com/Bahmni/openmrs-module-bahmniapps/pull/281

Curious if any developer has looked at this dependency list in awhile, I get a few warnings about the libraries being deprecated.

Romain, I’m curious, because you said you got the dev environment working with the current git, can you run a test on your system. I’m getting an error when I “save details” in the Visit Attributes page (with the Registration Fees and Patient Height and Weight) When I click save I get this error

TypeError: encounter.extensions.mdrtbSpecimen is undefined

I tracked it down to a change in the encounterService.js file:

return encounter.extensions.mdrtbSpecimen.map(function (observation) {
...

There is a commit on the current dev trunk BAH-379

https://github.com/Bahmni/openmrs-module-bahmniapps/commit/66c95f6f6e386e34a4affca770810bd61d592cff

It has to do with deleting files from the Bacteriology module, but the mdrtbspecimen was added at that commit. Maybe this is supposed to work with a newer version of the bacteriology module, or some other code that wasn’t included.

I’m just curious if I did something wrong, or if the current git repo isn’t compatible with the 0.92 database and omods, or something else.

I’m new to this, so I’m trying to learn as much as I can.

I said exactly :grinning: :

Haven’t tried the tip of dev branch in a while.

Maybe @angshuonline or @binduak would know more?