lforms icon indicating copy to clipboard operation
lforms copied to clipboard

Local setup instructions in README.MD

Open rajesh-bandarupalli opened this issue 4 years ago • 13 comments

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.

rajesh-bandarupalli avatar Jan 21 '21 06:01 rajesh-bandarupalli

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/.

plynchnlm avatar Jan 22 '21 01:01 plynchnlm

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.

rajesh-bandarupalli avatar Jan 24 '21 18:01 rajesh-bandarupalli

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/

plynchnlm avatar Jan 26 '21 23:01 plynchnlm

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?

rajesh-bandarupalli avatar Jan 28 '21 05:01 rajesh-bandarupalli

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:

  • Install Node.js (version 10 is what we are currently using, but it should work with later versions)
  • Clone the lforms repository and cd to its directory
  • npm ci
  • Make sure node_modules/.bin is in your path
  • bower install
  • npm run build
  • npm run start # starts the app we use for testing
  • npm run test # runs the tests
  • Templates are in app/views; CSS in app/styles

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).

plynchnlm avatar Jan 29 '21 13:01 plynchnlm

npm run start fails and throws below error.

10 silly lifecycle [email protected]~start: Args: [ '-c', 'grunt serve' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] 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 [email protected]

rajesh-bandarupalli avatar Jan 30 '21 18:01 rajesh-bandarupalli

"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"?

plynchnlm avatar Feb 01 '21 13:02 plynchnlm

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

rajesh-bandarupalli avatar Feb 02 '21 03:02 rajesh-bandarupalli

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.

plynchnlm avatar Feb 02 '21 22:02 plynchnlm

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

> [email protected] 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

> [email protected] 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

> [email protected] 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

> [email protected] 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 avatar Feb 03 '21 00:02 rajesh-bandarupalli

@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.

rajesh-bandarupalli avatar Feb 03 '21 00:02 rajesh-bandarupalli

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).

plynchnlm avatar Feb 03 '21 13:02 plynchnlm

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.

rajesh-bandarupalli avatar Feb 03 '21 17:02 rajesh-bandarupalli