handlebars.js is not recognised by ember - ember.js

I try to update https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences
with the newest versions of some scripts. All work except Ember (1.2.0) gives an error:
Assertion failed: Ember Handlebars requires Handlebars version 1.0 or 1.1. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.
Error disappears when I activate the same script without dependencies but with
<script src="../dependencies/handlebars.js"></script>

I think question should be marked as answered. I got it work with https://github.com/gcollazo/brunch-with-ember-reloaded

Related

Error: Assertion Failed: You must provide one or more parameters to the link-to component

I'm following the emberjs tutorial and I am getting an error when adding a <LinkTo> tag. I'm not sure what it means as I can't find any documentation what I need to do to properly construct this tag.
What do I need to do to construct this properly? It doesn't render on the page.
Here is my environment:
ember-cli: 3.6.1
node: 13.12.0
os: darwin x64
Here is the error in the console:
Error: Assertion Failed: You must provide one or more parameters to the link-to component.
Here are the relevant code snippets
app/templates/index.hbs
<div class="jumbo">
<div class="right tomster"></div>
<h2>Welcome to Super Rentals!</h2>
<p>We hope you find exactly what you're looking for in a place to stay.</p>
<LinkTo #route="about">About</LinkTo>
</div>
app/router.js
import EmberRouter from '#ember/routing/router';
import config from './config/environment';
export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}
Router.map(function() {
this.route('about');
});
Your invocation syntax is correct. However, you are referring the guide for the latest version of Ember whereas you have installed Ember version 3.6. You can either bump up your ember version to the latest or if you want to stick to 3.6, here goes the guide for 3.6.
The actual error is due to the fact that the true angle bracket component invocation style for Built-In components was only landed on Ember version 3.10. So, your Ember version has to be => 3.10 to work.
Here is a twiddle that demonstrates the usage of LinkTo component using Ember version 3.17

HandlebarsHelper compiled templates tempateSpec.call undefined

I am having an issue with the HandlebarsHelper compiled templates on an MVC5 site. Here is the code for the BundleConfig:
bundles.Add(new Bundle("~/bundles/templates", new HandlebarsTransformer())
.IncludeDirectory("~/App/templates", "*.hbs", true));
This was working fine locally and then I pushed to a server hosting the QA environment and I was getting an assembly reference error saying the HandlebarsHelper plugin was calling Jurassic 2.1.0.0 and it wasn't found. So I added Jurassic through Nuget, since then the templates stopped working. I get this error from the browser:
Chrome:
Uncaught TypeError: undefined is not a function
Firefox:
TypeError: templateSpec.call is not a function
This is happening in the following section of handlebars.js:
return function(context, options) {
options = options || {};
var namespace = options.partial ? options : env,
helpers,
partials;
if (!options.partial) {
helpers = options.helpers;
partials = options.partials;
}
var result = templateSpec.call(
container,
namespace, context,
helpers,
partials,
options.data);
if (!options.partial) {
env.VM.checkRevision(container.compilerInfo);
}
return result;
};
I am running:
Ember 1.7.0
Ember-Data 1.0.0-beta.11
Handlebars 1.3.0
JQuery 2.1.1
MVC 5
.Net 4.5.2
I have been searching online all morning and not found any answers yet that have worked, I tried removing the Jurassic Nuget package and it did not help. Any ideas would be appreciated, let me know if there is any other info that would help diagnosing the issue.
You're on a version of HandlbarsHelper that's not supported for that version of Ember.js.
There was a breaking change for version 1.9 which added support for handlebars version 2.0. This is supported in HandlebarsHelper v2.0+. As a breaking change it means 2.0+ can't be used with Ember.JS < v1.9 and Handlebars < v2.0.
The reason why it was probably working initially was because in debug templates are usually just injected into the page unminified.
Easy fix is to use HandlebarsHelper v1.1 (https://www.nuget.org/packages/HandlebarsHelper/1.1.0)
The problem was I was using a version of Handlebars Helper that only supported handlebars 2.x. Found the issue in Nuget and changed it to a different version, everything works now. Thanks for the comments.

Can't use ember-components in my app

After installing ember-components via bower, I'm trying to use it;
depending on the component I get different errors;
for example if I try to use the tab component (simple version), I get this:
Assertion Failed: `blockHelperMissing` was invoked without a helper name, which is most likely due to a mismatch between the version of Ember.js you're running now and the one used to precompile your templates. Please make sure the version of `ember-handlebars-compiler` you're using is up to date.
Error: Assertion Failed: `blockHelperMissing` was invoked without a helper name, which is most likely due to a mismatch between the version of Ember.js you're running now and the one used to precompile your templates. Please make sure the version of `ember-handlebars-compiler` you're using is up to date.
With other components (such as accordion) I get errors like this:
Uncaught Error: <App.ItaHomeView:ember360> Handlebars error: Could not find property 'em-accordion' on object <App.HomeController:ember408>.
I'm using Ember 1.7.0, with handlebars 1.3.0 and ember-components 0.2.0
Can anyone please explain what I am doing wrong?

Handlebars link-to throwing error in ember-rails

I'm using the ember-rails gem and following along with the starter screencast on the Emberjs.com site. When I create this link
<li>{{#link-to 'about'}} About {{/link-to}}</li>
It's giving me this error
Uncaught Error: Handlebars error: Could not find property 'link-to' on object <(generated application controller):ember280>.
There's a StackOverflow question that deals with this issue Helpers not properly defined in application template?. One answer says that
When you use Handlebars.compile it uses the handlebars script instead
of the Ember script. Ember has its own handlebars object that extends
the original Handlebars object with extra templates.
and gives this example
Ember.TEMPLATES["application"] = Ember.Handlebars.compile("{{#linkTo 'dashboard'}}Dashboard{{/linkTo}}")
However, I'm unclear where to put that code, and would it need to be done for every link?
I suspect you're running an older version of ember. Try running this to get the latest version of Ember into your app.
rails generate ember:install --head

ember-data initialization error: "Uncaught TypeError"

I have just downloaded ember-1.0.0-pre.4.js and ember-data-latest.js and get the following error upon the initialization of the app:
Uncaught TypeError: Object Ember.Application has no method 'registerInjection'
How can I fix this?
Unfortunately ember-data-latest.js on GitHub isn't up-to-date with Ember Pre 4. You'll have to git clone the Ember DS repository, and then build them using rake.
You can find it here or the minified version from here
you can get it from http://cdnjs.com/ concretely:
//cdnjs.cloudflare.com/ajax/libs/ember-data.js/0.8.0-latest20121123/ember-data-latest.min.js
//cdnjs.cloudflare.com/ajax/libs/ember-data.js/0.8.0-latest20121123/ember-data-latest.js