LHNCBC / lforms

See the project website at http://lhncbc.github.io/lforms/, or view the demo website at https://lhcforms.nlm.nih.gov/lhcforms.
Other
103 stars 56 forks source link

Local setup instructions in README.MD #52

Open rajesh-bandarupalli opened 3 years ago

rajesh-bandarupalli commented 3 years ago

I couldn't run this app in local. Please post the instructions to run the application in local. It will be helpful for the beginners to explore the application by making changes in index.html file.

plynchnlm commented 3 years ago

lforms is a widget, not an app, though it does include an application we use for our to end-to-end tests. Is that what you were trying to run? If so, why? I hope you found the developer documentation over at http://lhncbc.github.io/lforms/.

rajesh-bandarupalli commented 3 years ago

I am exploring on how the form is being rendered based on FHIR Questionnaire Json, I found that rendering logic is inside this repo. Since it has the complete logic to render the form, I tried to run this widget as standalone app instead of including it as a dependency in another angularJs app.

plynchnlm commented 3 years ago

As documented at http://lhncbc.github.io/lforms/, you do not need an AngularJS app. You can just call LForms.Util.addFormToPage. See the demos for an example-- in particular this one: https://jsfiddle.net/lforms/8f754jhy/

rajesh-bandarupalli commented 3 years ago

I have gone through the example mentioned above. I would like to understand the lforms widget, then I can try to customize styling of the form, and add support for SDC extensions. I found that this app https://github.com/lhncbc/lforms-fhir-app has local setup instructions to customize it and I am able to run it in my machine and make changes. Similarly Can you provide instructions to customize lforms widget?

In short, how do we setup lforms widget in local, make code changes and test it?

plynchnlm commented 3 years ago

Okay, we can add a section to the README about how where to find the templates and styles, how to build it, and run the test server, and run the tests.

In the meantime:

If you want to contribute your new support for SDC extensions back to us, please coordinate with me. lforms is under active development, and we are working on additional SDC extensions too (though not at the pace I would like, so help is welcome).

rajesh-bandarupalli commented 3 years ago

npm run start fails and throws below error.

10 silly lifecycle lforms@28.1.1~start: Args: [ '-c', 'grunt serve' ]
11 silly lifecycle lforms@28.1.1~start: Returned: code: 1  signal: null
12 info lifecycle lforms@28.1.1~start: Failed to exec start script
13 verbose stack Error: lforms@28.1.1 start: `grunt serve`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid lforms@28.1.1
plynchnlm commented 3 years ago

"npm run start" works for me. 1) What operating system are you using? 2) node --version ? 3) npm --version ? 4) Did you run "npm ci"?

rajesh-bandarupalli commented 3 years ago

I ran npm ci and npm run build is successful.

  1. OS: macOS Catalina 10.15.7
  2. node: v14.15.4
  3. npm: 6.14.10
  4. bower: 1.8.12
plynchnlm commented 3 years ago

I tried npm ci on Catalina 10.15.7, and got an error that said: "gyp: No Xcode or CLT version detected!", plus a stack trace. It then produced a bunch of other output without further errors. I tried npm run start, and it failed. I suspect that error message is the reason, and I am wondering if you see that error when running npm ci. You might have to scroll up a bit to see it, becuase the process does not exit immediately afterward.

rajesh-bandarupalli commented 3 years ago

I had resolved that error by googling and following steps from stackoverflow. [https://stackoverflow.com/questions/60573595/npm-install-fails-on-node-gyp-rebuild-with-gyp-no-xcode-or-clt-version-detec]()

Please find the logs printed on console when i run npm ci

npm WARN prepare removing existing node_modules/ before installation

> fsevents@1.2.13 install /Users/Rajesh/code/lforms/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> phantomjs-prebuilt@2.1.16 install /Users/Rajesh/code/lforms/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-macosx.zip
Saving to /var/folders/nt/z0f9wq150_jdcts5x8z9wjnh0000gp/T/phantomjs/phantomjs-2.1.1-macosx.zip
Receiving...
  [===================---------------------] 46%
Received 16746K total.
Extracting zip contents
Removing /Users/Rajesh/code/lforms/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /var/folders/nt/z0f9wq150_jdcts5x8z9wjnh0000gp/T/phantomjs/phantomjs-2.1.1-macosx.zip-extract-1612311859312/phantomjs-2.1.1-macosx -> /Users/Rajesh/code/lforms/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /Users/Rajesh/code/lforms/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs

> node-sass@4.14.1 install /Users/Rajesh/code/lforms/node_modules/node-sass
> node scripts/install.js

Cached binary found at /Users/Rajesh/.npm/_cacache/node-sass/4.14.1/darwin-x64-83_binding.node

> node-sass@4.14.1 postinstall /Users/Rajesh/code/lforms/node_modules/node-sass
> node scripts/build.js

Binary found at /Users/Rajesh/code/lforms/node_modules/node-sass/vendor/darwin-x64-83/binding.node
Testing binary
Binary is fine
added 1199 packages in 19.286s
rajesh-bandarupalli commented 3 years ago

@plynchnlm it would be better if you could add Dockerfile to this repo, that guarantees to work across multiple platforms and helps folks exploring this repo to save time on workspace setup.

plynchnlm commented 3 years ago

The "npm run start" command is failing on "grunt serve". If you run "grunt serve" directly, does it provide any more information?

If "grunt" is having an issue on MacOS I am not sure what we can do about it. You might find it easier to run CentOS in a VM (e.g. VirtualBox).

rajesh-bandarupalli commented 3 years ago

It logs below error in console when I run grunt serve.


Running "watch" task
Waiting...
Fatal error: Exited with code 1

Execution Time (2021-02-03 12:06:42 UTC-5)
loading tasks                    5ms  ▇▇ 2%
loading grunt-contrib-connect  100ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 38%
connect:livereload              32ms  ▇▇▇▇▇▇▇▇▇▇ 12%
loading grunt-contrib-watch     84ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 32%

I will install VM and give a try.

Thanks.