anvaka / VivaGraphJS

Graph drawing library for JavaScript
Other
3.72k stars 423 forks source link

Cannot run any example code #171

Open oldmonk101 opened 8 years ago

oldmonk101 commented 8 years ago

Getting the same errors every time

vivagraph.js:1 Uncaught SyntaxError: Unexpected token < index_twit_viva.html:8 Uncaught ReferenceError: Viva is not defined

anvaka commented 8 years ago

What is this file index_twit_viva.html?

oldmonk101 commented 8 years ago

Sorry to miss that info. That is the same content as the demo - "01 - Create Graph.html"

anvaka commented 8 years ago

The example works here: https://anvaka.github.io/VivaGraphJS/demos/tutorial_svg/01%20-%20Create%20Graph.html

Are you sure vivagraph is loaded on your page? Do you see any other errors in the developer console?

oldmonk101 commented 8 years ago

No other error besides those two. I think the vivagraph is not loading, although the local path for the file vivagraph.js is correct.

oldmonk101 commented 8 years ago

I changed the line in demo to this -

Now the only error I am getting is this - index_twit_viva.html:10 Uncaught ReferenceError: Viva is not defined

main @ index_twit_viva.html:10 onload @ index_twit_viva.html:33

joerodrig commented 8 years ago

Just wondering, if this is a node app you just created, are you able to load in any other local JS files just fine? If you're using something like express, your app.js package should have something like this:


// Load static files (ie public/javascripts/*.js)
app.use(express.static(path.join(__dirname, 'public')));

Then you can put the vivagraph dist file in public/javascripts/vivagraph.js and be able to call it from your view template as : <script src="javascripts/vivagraph.js"></script>

I created a boilerplate repo that may help a bit: https://github.com/joerodrig3/vivagraph-boilerplate