Skip to content

ReferenceError: window is not defined #64

@jwnx

Description

@jwnx

I'm getting this error while trying to follow Ari's tutorial.

ReferenceError: window is not defined
at /home/drstein/projects/react-tests/node_modules/google-maps-react/dist/lib/ScriptCache.js:20:21
at Object.defineProperty.value (/home/drstein/projects/react-tests/node_modules/google-maps-react/dist/lib/ScriptCache.js:5:9)
at Object.<anonymous> (/home/drstein/projects/react-tests/node_modules/google-maps-react/dist/lib/ScriptCache.js:13:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.defineProperty.value (/home/drstein/projects/react-tests/node_modules/google-maps-react/dist/GoogleApiComponent.js:5:66)
at Object.<anonymous> (/home/drstein/projects/react-tests/node_modules/google-maps-react/dist/GoogleApiComponent.js:13:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
/home/drstein/projects/react-tests/tools/runServer.js:80
      throw new Error(`Server terminated unexpectedly with code: ${ code } signal: ${ signal }`);
      ^

Error: Server terminated unexpectedly with code: 1 signal: null
at ChildProcess.server.once (/home/drstein/projects/react-tests/tools/runServer.js:54:17)
at ChildProcess.g (events.js:292:16)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
error Command failed with exit code 1.

This is my MapLocation.js:

import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import {Map, GoogleApiWrapper} from 'google-maps-react';
import s from './MapLocation.css';

export class MapLocation extends React.Component {
 render () {
      if (!this.props.loaded) {
              return (<div>Loading...</div>)
      }

      return (<div> Hello </div>)
  }
}

export default GoogleApiWrapper({
  apiKey: __GAPI_KEY__
})(MapLocation)

Any ideas? Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions