qqq
qqq

Reputation: 80

Can not find 'EJS' Typescript and Express

I'm trying to use EJS with typescript, I can use res.send

app.set('views', path.join(__dirname, 'src/views/'));
app.set('view engine', 'ejs');

        app.get('/index', function (req, res, next) {
        res.send('hello')  
    });

But, when I try to use render method I get Error: Cannot find module 'ejs'. I'm sure that I installed ejs as globally and locally. What can cause that?

Upvotes: 3

Views: 9140

Answers (1)

Mattia Rasulo
Mattia Rasulo

Reputation: 1451

EJS is not made to work with TypeScript natively.

Please check here how to properly set that up to be integrated in Express:

https://developer.okta.com/blog/2018/11/15/node-express-typescript

Upvotes: 2

Related Questions