问题
I want to run bpmn in localhost. After browsing whole day, I tried this steps
- install nodejs
- npm install bpmn-js // in cmd
After this don't know want to do.
also tried
- downloading bpmn example files
- 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
- Download bpmn example files and save it in localhost directory
- Install nodejs
- 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 )
- Install browserify using command => npm install browserify ( without changing path )
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)
- After this bundle.js file is created in the same path.
- Open index.html in editor and replace index.js with bundle.js in script tag.
- open index.html in browser.
来源:https://stackoverflow.com/questions/35062625/bpmn-io-examples-not-working-in-localhost