Closed andreapernici closed 5 years ago
Can you show us where you include head.njk
? It looks like Eleventy gets the content of a file instead of a file path.
Also, @zachleat, the Template render error should report more information. Like this, you can’t necessarily track down from where the error is thrown.
It's pretty odd the situation.
I have 2 identical project in 2 different folder and I get the error only on one project.
The head.njk file is located in _includes The base.njk file including head.njk is located in _includes/layouts/ The printed output of the js file is simply a variable set to inline the js that is in _includes/inline-js/
The error happens here.
{% set sw %}{% include "inline-js/service-worker-registration.js" %}{% endset %}
{% set ga %}{% include "inline-js/googleanalytics.js" %}{% endset %}
{% set fb %}{% include "inline-js/facebookpixel.js" %}{% endset %}
{% set tw %}{% include "inline-js/twitteruniversaltag.js" %}{% endset %}
{% set carrelletto %}{% include "inline-js/carrelletto.js" %}{% endset %}
{% set videojs %}{% include "inline-js/fascia-video.njk" %}{% endset %}
<script>{{ sw | jsmin | safe }}{{ ga | jsmin | safe }}{{ fb | jsmin | safe }}{{ tw | jsmin | safe }}{{ carrelletto | jsmin | safe }} </script>
If I remove the sets the error skip till the next file footer.njk including other sets....
Is like it is messing up with paths, but using DEBUG I don't get any additional info on the error.
Just to be more clearer the project where I got those errors happens only on my remote installation. Locally to other team members it works.
Hmm, I think we're going to need a better test case here. From the original error it seems to be trying to include the files contents rather than a path to the file? But it doesn't seem obvious to me why it would be doing that from the code sample you provided.
Yes is pretty strange cause this happen only on a Server where another instance of eleventy is running without any issue and with the same code.
Looks weird.
Maybe it depends by a global eleventy installation? I'm on Centos 7
I guess I had a couple ideas here that might be worth trying:
{{ fb | jsmin | safe }}
{{
include
is supposed to be used on .js
files like this. As https://mozilla.github.io/nunjucks/templating.html#include states it does a full Nunjucks render on the included content.ga
include and see if it fails or succeeds.I got this error too. Not sure why. But deleting the _site
folder and building again seems to have fixed it.
This is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.
If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and I will reopen the issue. Thanks!
I get the following error. Looks like it got errors during the file inclusion, but obviously files are there and it print out the source of the file, but don't processo the files.