BPMN.IO examples not working in localhost

守給你的承諾、 提交于 2019-12-23 04:47:33

问题


I want to run bpmn in localhost. After browsing whole day, I tried this steps

  1. install nodejs
  2. npm install bpmn-js // in cmd

After this don't know want to do.

also tried

  1. downloading bpmn example files
  2. saved it in local path and opened "localhost/bpmn-js-examples-master/properties-panel/app" in chrome.

and getting error in console => "Uncaught ReferenceError: require is not defined"

To solve this I have include require.js file to index.html ( inside "localhost/bpmn-js-examples-master/properties-panel/app" )

but now getting new console error => "Uncaught Error: Module name "fs" has not been loaded yet for context: _. Use require([])"

Please, anyone help me with this.


回答1:


From their github:

Make sure you use browserify or the like to bundle your project and bpmn-js for the browser.

There is also a sample project provided for node environment. You can use the sample and build around it. The important part you're missing is the grunt script browserifying your code (this process prevents the require is not defined error).




回答2:


I got answer after getting idea from ShanShan's answer.

Steps to run BPMN.IO in localhost is

  1. Download bpmn example files and save it in localhost directory
  2. Install nodejs
  3. Open cmd and go to the path where you want to run BPMN ( example: cd c:/.../bpmn-js-examples-master/properties-panel/app. Here you will see 3 files index.js, index.html, css folder )
  4. Install browserify using command => npm install browserify ( without changing path )
  5. Then run => browserify index.js -o bundle.js or browserify -t brfs index.js > bundle.js according to requirement. see Stackoverflow answer of Substack

    5.1 if got error like "brfs module missing" then execute => npm install brfs

    5.2 if got error like "xxxx module missing" then execute => npm install xxxx ( till all module installed)

  6. After this bundle.js file is created in the same path.
  7. Open index.html in editor and replace index.js with bundle.js in script tag.
  8. open index.html in browser.


来源:https://stackoverflow.com/questions/35062625/bpmn-io-examples-not-working-in-localhost

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!