2 Uncaught TypeError using google-map
Closed this issue · 15 comments
I wanted to user this element on my website
https://elements.polymer-project.org/elements/google-map
so I installed it with bower
bower install --save GoogleWebComponents/google-map
and added it to my application.html
// This is a manifest file that'll be compiled into application.html, which will include all the files
// listed below.
//
// Any web component HTML file within this directory or vendor/assets/components, if any,
// can be referenced here using a relative path.
//
//= require polymer/polymer
//= require google-map/google-map
Now when I use it, like this:
<style>
google-map {
height: 600px;
}
</style>
<google-map latitude="37.77493" longitude="-122.41942"></google-map>
I get this errors on the console
Uncaught TypeError: Cannot read property '_notifyEffect' of undefined
Uncaught TypeError: Cannot read property '_importsLoaded' of undefined
Did I miss a step here?
Which version of polymer-rails ?
In my Gemfile I have
gem 'polymer-rails'
So I guess the last one. In any case, I fixed it by removing the line that was added in application.js (Which by the way, is not //= require webcomponentsjs/webcomponents-lite
as the README says)
Well, I figured out why it was not working.... The folder vendor/assets/javascripts/
is empty! Should it be hosting webcomponents-lite.js?? Why is that not there after running rails g polymer:install
?
vendor/assets/javascripts/
should not be hosting webcomponents-lite.js
. This file is in gem assets folder.
Then how come my application.js cant find it either way?
It depends on you app setup and code... Try to look into the output of Rails.application.config.assets.paths
in rails console.
What should I be looking for there? There are many entries..
for something like gems/polymer-rails-1.0.x/app/assets/javascripts
In the path list I only have gems/polymer-rails-0.2.8/app/assets/javascripts
, even though in the gems
folder I have installed 0.2.2, 0.2.8, and 1.0.0...
Could it have anything to do with the fact that I first tried to install the gem, but then I got an error because I had to update Sprockets to a version < 3.0
...?
So, you're using old version of gem, which did not have webcomponents-js
yet. Update to v1.0.x
As you can see, I have it installed. The folder is there. It is just not in the paths
. How do I fix that?
Look into Gemfile.lock
which version of polymer-rails is intalled in your project?
Doing bundle update
fixed all. I wonder why it was not working from the beginning. In any case, thanks! :)
That's because you need specify version of gem in your Gemfile – gem 'polymer-rails', '1.0.8'
And of course use latest version