dburles / meteor-google-maps

🗺 Meteor package for the Google Maps Javascript API v3
https://atmospherejs.com/dburles/google-maps
MIT License
196 stars 49 forks source link

ReferenceError: GoogleMaps is not defined #91

Closed therealrobster closed 9 years ago

therealrobster commented 9 years ago

Hi there,

I've just tried installing your package, am excited to take it for a spin.

I performed the default install into my app via: meteor add dburles:google-maps

I checked it's installed by using: meteor list and the following was retrieved:

I have the following in my JS code only:

if (Meteor.isClient) {
  Template.map.helpers({
      //helpers go here
     });

  Template.map.events({
   //events go here
  });
}

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
    GoogleMaps.load();
  });
}

When I try and run the code though, this is what happens:

[[[[[ ~/Sites/meteor/gmaps01 ]]]]]            

=> Started proxy.                             
=> Started MongoDB.                           
W20151031-09:28:09.219(10)? (STDERR)          
W20151031-09:28:09.220(10)? (STDERR) /Users/username/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151031-09:28:09.220(10)? (STDERR)                        throw(ex);
W20151031-09:28:09.221(10)? (STDERR)                              ^
W20151031-09:28:09.221(10)? (STDERR) ReferenceError: GoogleMaps is not defined
W20151031-09:28:09.221(10)? (STDERR)     at gmaps01.js:21:5
W20151031-09:28:09.221(10)? (STDERR)     at /Users/username/Sites/meteor/gmaps01/.meteor/local/build/programs/server/boot.js:249:5
=> Exited with code: 8
W20151031-09:28:13.139(10)? (STDERR)          
W20151031-09:28:13.140(10)? (STDERR) /Users/username/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151031-09:28:13.140(10)? (STDERR)                        throw(ex);
W20151031-09:28:13.140(10)? (STDERR)                              ^
W20151031-09:28:13.147(10)? (STDERR) ReferenceError: GoogleMaps is not defined
W20151031-09:28:13.147(10)? (STDERR)     at gmaps01.js:21:5
W20151031-09:28:13.147(10)? (STDERR)     at /Users/username/Sites/meteor/gmaps01/.meteor/local/build/programs/server/boot.js:249:5
=> Exited with code: 8
W20151031-09:28:16.961(10)? (STDERR)          
W20151031-09:28:16.962(10)? (STDERR) /Users/username/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151031-09:28:16.962(10)? (STDERR)                        throw(ex);
W20151031-09:28:16.962(10)? (STDERR)                              ^
W20151031-09:28:16.967(10)? (STDERR) ReferenceError: GoogleMaps is not defined
W20151031-09:28:16.968(10)? (STDERR)     at gmaps01.js:21:5
W20151031-09:28:16.968(10)? (STDERR)     at /Users/username/Sites/meteor/gmaps01/.meteor/local/build/programs/server/boot.js:249:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

So the error at line 21:5 is: GoogleMaps.load();

Can you see anything I'm doing incorrectly? I'd love to make a start with the maps tools but am stuck at the start.

Many thanks.

Rob

dburles commented 9 years ago

Hey the problem there is that GoogleMaps is client side only

On 31 Oct 2015, at 11:11 AM, therealrobster notifications@github.com wrote:

Hi there,

I've just tried installing your package, am excited to take it for a spin.

I performed the default install into my app via: meteor add dburles:google-maps

I checked it's installed by using: meteor list and the following was retrieved:

autopublish 1.0.4 (For prototyping only) Publish the entire database to all clients blaze-html-templates 1.0.1 Compile HTML templates into reactive UI with Meteor Blaze dburles:google-maps 1.1.5 Google Maps Javascript API v3 ecmascript 0.1.6 Compiler plugin that supports ES2015+ in all .js files es5-shim 4.1.14 Shims and polyfills to improve ECMAScript 5 support insecure 1.0.4 (For prototyping only) Allow all database writes from the client jquery 1.11.4 Manipulate the DOM using CSS selectors meteor-base 1.0.1 Packages that every Meteor app needs mobile-experience 1.0.1 Packages for a great mobile user experience mongo 1.1.3 Adaptor for using MongoDB and Minimongo over DDP session 1.1.1 Session variable standard-minifiers 1.0.2 Standard minifiers used with Meteor apps by default. tracker 1.0.9 Dependency tracker to allow reactive callbacks I have the following in my JS code only:

if (Meteor.isClient) { Template.map.helpers({ //helpers go here });

Template.map.events({ //events go here }); }

if (Meteor.isServer) { Meteor.startup(function () { // code to run on server at startup GoogleMaps.load(); }); } When I try and run the code though, this is what happens:

[[[[[ ~/Sites/meteor/gmaps01 ]]]]]

=> Started proxy.
=> Started MongoDB.
W20151031-09:28:09.219(10)? (STDERR)
W20151031-09:28:09.220(10)? (STDERR) /Users/username/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future .js:245 W20151031-09:28:09.220(10)? (STDERR) throw(ex); W20151031-09:28:09.221(10)? (STDERR) ^ W20151031-09:28:09.221(10)? (STDERR) ReferenceError: GoogleMaps is not defined W20151031-09:28:09.221(10)? (STDERR) at gmaps01.js:21:5 W20151031-09:28:09.221(10)? (STDERR) at /Users/username/Sites/meteor/gmaps01/.meteor/local/build/programs/server/boot.js:249:5 => Exited with code: 8 W20151031-09:28:13.139(10)? (STDERR)
W20151031-09:28:13.140(10)? (STDERR) /Users/username/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future .js:245 W20151031-09:28:13.140(10)? (STDERR) throw(ex); W20151031-09:28:13.140(10)? (STDERR) ^ W20151031-09:28:13.147(10)? (STDERR) ReferenceError: GoogleMaps is not defined W20151031-09:28:13.147(10)? (STDERR) at gmaps01.js:21:5 W20151031-09:28:13.147(10)? (STDERR) at /Users/username/Sites/meteor/gmaps01/.meteor/local/build/programs/server/boot.js:249:5 => Exited with code: 8 W20151031-09:28:16.961(10)? (STDERR)
W20151031-09:28:16.962(10)? (STDERR) /Users/username/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future .js:245 W20151031-09:28:16.962(10)? (STDERR) throw(ex); W20151031-09:28:16.962(10)? (STDERR) ^ W20151031-09:28:16.967(10)? (STDERR) ReferenceError: GoogleMaps is not defined W20151031-09:28:16.968(10)? (STDERR) at gmaps01.js:21:5 W20151031-09:28:16.968(10)? (STDERR) at /Users/username/Sites/meteor/gmaps01/.meteor/local/build/programs/server/boot.js:249:5 => Exited with code: 8 => Your application is crashing. Waiting for file change. So the error at line 21:5 is: GoogleMaps.load();

Can you see anything I'm doing incorrectly? I'd love to make a start with the maps tools but am stuck at the start.

Many thanks.

Rob

— Reply to this email directly or view it on GitHub.

therealrobster commented 9 years ago

Well that's a bit embarrassing but thank you for replying (and so quickly). I'm very new to Meteor and javascript in general so I appreciate your help. Thanks so much, that worked perfectly. Hopefully this will help another beginner in the future.

Thanks again. Rob

dburles commented 9 years ago

No problem