Closed lewiswalsh closed 9 years ago
I was also facing this issue. Downgrading to 1.2.2 solved the problem for me.
My findings were that express-handlebars
has dependency to handlebars
like "handlebars": "^3.0.0",
so it tries to install the latest handlebars
. Current handlebars
version is 3.0.2 somehow breaks express-handlebars
That solved it for me too! Thanks.
I will look into the Handlebars' changelog to see what changed between 3.0.0 and 3.0.2. From what you're saying, it looks like semver was broken, which is unfortunate. Another way around this issue would be you add "handlebars": "3.0.0"
to your package.json
and pass that copy of Handlebars to Express Handlebars via the config options.
handlebars.js Issue 1003 was opened on that project and has a suggested workaround while this gets worked out.
Sweet mother of Jesus, I have spent hours troubleshooting this issue... I thought I was going mad. Indeed, adding the workaround mentioned in handlebars.js Issue 1003 worked for me as well. What a pain!
It looks like it is happening because of handlebars 3.0.2 which was being installed bundled with your package. I killed my node-modules and force loaded handlebars 3.0.1 ( npm install --save handlebars@3.0.1 ) then did a npm install and this seems to have resolved my problem. I spent a lot of time troubleshooting because it was only happening on my production box. What a pain. For some reason this page hasn't been indexed by google so it never showed up in a search. It would have saved me some headache. Bah! Just thought I would share a quick and easy fix that doesn't require mods to sources.
Release a guard against this in 2.0.1
Getting a bizarre error I've not seen before. The only change I made was the way Git handles line endings, but I doubt that would cause it. Using Express-handlebars v2.0.0 when I try to "res.render" I get the following:
The issue seems to be because line 124 is:
return this._compileTemplate(file, this.compilerOptions);
But
compilerOptions
is set tonull
here on line 31:compilerOptions: null,
Any help would be greatly appreciated.