Meteor crashing "ReferenceError: document is not defined"

Viewed 1144

I'm trying to do a simple hello world in Meteor using React.js. When i try running the application it's crashing with "ReferenceError: document is not defined". This error doesn't make sense to me, how can document be undefined?

client HTML

<head>
  <title>Testing 123</title>
</head>

<body>
  <div id="root"></div>
</body>

Client Javascript

    import React from 'react';
    import ReactDOM from 'react-dom';

    Meteor.startup(() => {
        ReactDOM.render(<h1>Hello World</h1>, document.getElementById('root'));
    });

Full error log

C:\Users\Klynicol\AppData\Local\.meteor\packages\meteor-tool\1.4.4_3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:280
                    throw(ex);
                    ^

ReferenceError: document is not defined
at Client/main.js:18:28
at Function.time (c:\MeteorTut\meteortut\.meteor\local\build\programs\server\profile.js:309:28)
at c:\MeteorTut\meteortut\.meteor\local\build\programs\server\boot.js:312:13
at c:\MeteorTut\meteortut\.meteor\local\build\programs\server\boot.js:353:5
at Function.run (c:\MeteorTut\meteortut\.meteor\local\build\programs\server\profile.js:510:12)
at c:\MeteorTut\meteortut\.meteor\local\build\programs\server\boot.js:351:11
Exited with code: 1
Your application is crashing. Waiting for file change.

Any help would be greatly appreciated!

2 Answers
Related