I'm trying to start a Mozart app, but nothing is rendering and I'm getting the error...
TypeError: this.merge is not a function
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
Nothing obviously related has changed - ie. haven't changed the templates etc so it's hard to see what's wrong. Have tried an npm install and re-run to no avail. Anyone hit this problem?
It sounds like the version of Handlebars used to precompile your templates is different to the version actually running on your page.
Specifically, this.merge was added in Handlebars 1.0.0 final, so if your page is still running an earlier version (like 1.0.0rc4) the method won't exist and things will break.
You need to either update the version of Handlebars used on your page, or drop back the version of Handlebars being used for template precompilation in package.json.
[Edit:] You can also sometimes get into trouble due to the way downstream dependencies are installed by NPM. For example, you might specify "handlebars": "1.0.11" in your package.json, but if another package has a dependency on Handlebars and uses a different version, it can be a bit of a lottery as to which version of Handlebars will be loaded when require() is called. You can get around this by running npm install --production to ensure duplicate dependencies are skipped (regardless of version), but the bottom line is probably "update to the latest version and stay consistent".
来源:https://stackoverflow.com/questions/18839775/how-do-i-resolve-type-error-this-merge-is-not-a-function-trying-to-run-mozart-ap