How to use io.js?


Normally here I would include main.js to my index.html file. But this would result in executing script “twice”. Sure, nothing wrong will happen, but I just don’t like the idea. It’s not neat. I’m currently stuck with is:

<!DOCTYPE html>
    <title>Hello World!</title>
        <link rel="stylesheet" href="style.css" />
      <script type="javascript">require('os')</script>
    <h1>Hello World!</h1>
    We are using io.js <script>document.write(process.version)</script>
    and Electron <script>document.write(process.versions['electron'])</script><br />.

Uncaught ReferenceError: os is not defined, so apparently I’m not as good with JavaScript as I thought I was. Could someone help me include io.js libraries (references in global) into a HTML file? In this case index.html, so I could refer to data as easy as at the example lines (also seen above)?

What am I missing?
Sorry for bothering.


Your error is not because node/io is missing but because need to assign the result of require('os') to a variable for later use:

os = require('os')


Let me facepalm myself real-quick. Thanks.