How do I resolve type error this.merge is not a function trying to run Mozart app?

爷,独闯天下 提交于 2019-12-06 09:32:31

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".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!