I'm getting this error in the all of the templates that I include using this:
{% include '../public/templates/header.html' %}
Does anyone know what could be wrong?
Error: UNKNOWN, unknown error '//../public/templates/header.html'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at getSingle (C:\project\node_modules\swig\lib\swig.js:152:19)
at get (C:\project\node_modules\swig\lib\swig.js:159:7)
at Object.exports.compileFile (C:\project\node_modules\swig\lib\swig.js:177:7)
at eval (eval at createRenderFunc (C:\project\node_modules\swig\lib\swig.js:44:10), :13:22)
at Object.eval (eval at createRenderFunc (C:\project\node_modules\swig\lib\swig.js:44:10), :15:3)
at Object.template.render (C:\project\node_modules\swig\lib\swig.js:111:21)
at C:\project\node_modules\swig\lib\swig.js:189:17
at Function.exports.swig.render (C:\project\node_modules\consolidate\lib\consolidate.js:245:14)
It looks like you're using Swig @v0.14.0, which is severely outdated. The entire engine was rewritten for v1.0.0, which brought about the ability to use relative paths. This feature previously didn't exist, so you always had to use absolute paths relative to your
root
.If you continue using v0.14.0, assuming your
root == './public/templates'
or similar:However, I'd highly recommend updating to the newest version, Swig @~1.2 for compatibility and support purposes.