Here is my complete error:
Error: Cannot find module \'ejs\'
at Function._resolveFilename (module.js:317:11)
at Function._load (module.js:262:25)
Add dependency in package.json
and then run npm install
{
...
...
"dependencies": {
"express": "*",
"ejs": "*",
}
}
In my case there was no silly syntax error, but same error arised. I had installed ejs and ejs-mate globally. I installed it locally and found my error resolved.
Installing express locally solved my same problem. npm i express --save
I had the same issue. Once I set environment variable NODE_PATH to the location of my modules (/usr/local/node-v0.8.4/node_modules in my case) the problem went away. P.S. NODE_PATH accepts a colon separated list of directories if you need to specify more than one.
app.set('view engine', 'ejs')
and then in the terminal
npm install ejs --save
resolves the issue