leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
647 stars 159 forks source link

Error: Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version (>= 4.0.0). #139

Closed zedtux closed 6 years ago

zedtux commented 8 years ago

I have upgraded some gems of my Rails 4 application, including the handlebars_assets gem (from version 0.20.2 to 0.21.0), and I have now the following error:

Error: Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version (>= 4.0.0).

I'm currently in development environment (so no assets pre-compilation done) and this gem was working fine before the upgrade.

I have in my app/assets/javascripts/application.js:

...
//= require handlebars
...
//= require handlebars-helpers
...

The handlebars-helpers file is a file with some registered helpers.

I have my templates placed in the app/assets/javascripts/templates/ folder and I'm using them with something similar to the following:

$('.target-class').prepend(HandlebarsTemplates['admin/activities/new_subject']());

I'm not really sure to understand how to upgrade the runtime. I have see in another issue the use of rake tmp:clear but it didn't helped me. How can I fix this ?

zedtux commented 8 years ago

Well this seems to not be an issue at all ... Probably I've missed to restart my server or something.

zedtux commented 8 years ago

Oops... the error is still present, sorry for the confusion.

I tried rake assets:clean, restart the server but I still have this issue.

AlexRiedler commented 8 years ago

Is it possible your also loading handlebars somewhere else in your sourcecode? and as a result there is two versions?

zedtux commented 8 years ago

I will check that and come back to you, thank you for helping :)

zedtux commented 8 years ago

While giving a try to the #145 issue, I got the error, but then downgrading back the version, removed it again.

One information more: I'm developing my Rails app using Docker and docker-compose. To be sure, I'm doing a docker-compose stop web and then docker-compose rm web and finally docker-compose up -d and I still have the error with a newer version. Have you heard anything about an issue using Docker with the load/reload of the Rails assets pipeline ?

zedtux commented 6 years ago

I removed this gem from my project so I'm closing the issue.