Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include is not a function #772

Closed
mrranger opened this issue Sep 28, 2024 · 1 comment
Closed

include is not a function #772

mrranger opened this issue Sep 28, 2024 · 1 comment

Comments

@mrranger
Copy link

mrranger commented Sep 28, 2024

"ejs": "^3.1.10",
"express": "^4.21.0",

index.js

const express = require('express');
const flash = require('connect-flash');
const session = require('express-session');
const passport = require('passport');
const fileUpload = require('express-fileupload');
const config = require('./config/config.json');
const path = require('path');

const app = express();
const http = require('http').Server(app);
const io = require('socket.io')(http);

const port = config.port;


app.use(express.static('./public'));
app.use(express.static('./themes'));
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use(express.urlencoded({ extended: true, limit: '5mb' }));
app.use(express.json());
app.use(fileUpload());

In login.ejs
<%- include('../partials/header.ejs') %>

everything works fine
views/login/login.ejs

When I try to do the same in views/app/dashboard.ejs
views/app/dashboard.ejs

<%- include('../partials/header.ejs') %>

I get an error

TypeError: C:\Users\range\Documents\GitHub\FAMQGTA\views\app\dashboard.ejs:77
75|
76|

77| <%- include('../partials/header.ejs') %>
78|
79|
80|

include is not a function

@mde
Copy link
Owner

mde commented Sep 28, 2024

Without having the entirety of your application code, it is impossible to debug an issue like this. Also, given the millions of installations EJS has every week, it is very unlikely the problem is in EJS itself. Debugging application code that uses EJS is beyond the scope of our project. If you can provide us a minimal test that demonstrates a bug in EJS itself, we're happy to take a look.

@mde mde closed this as completed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants