On many of my EJS pages I have the following code:
<%- include('elements/fbviewpagepixel.ejs') %>
It works perfectly fine except on this one page. On that one pages it gives me an error saying include is not a function
. It looks like I was able to fix it by changing the code above to the following:
<%- include elements/fbviewpagepixel.ejs %>
Why does the first version work on all of my pages except this one? Why does it give me an error on this one page? What is even the difference between the two?
In the later versions of EJS the "client" parameter key is reserved, and will therefore cause this error. Rename the key and it'll resolve your issue.
I think, this issus come from parameter passed in list. I had the same issus on rendering my user:
res.render("profil-client.ejs", {
client: myClient
});
But when I rename my parameter like this:
res.render("profil-client.ejs", {
r_client: myClient
});
No more error. I'm not sure, but I think ejs use attribute "client" for internal usage. So I just rename my parameters...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With