Here is my complete error:
Error: Cannot find module \'ejs\'
at Function._resolveFilename (module.js:317:11)
at Function._load (module.js:262:25)
I ran into this problem after I forgot to install ejs before the first time I ran my app. For some reason ejs was not being seen after installing it later. I found a quick, clean, and effective solution to this problem which was to reinstall express by running npm uninstall express
then npm install express
in the local directory before restarting the server.
I had this problem. I debugged using node-inspector and saw that from the node_modules folder where the express source files were, ejs was not installed. So I installed it there and it worked.
npm install -g ejs
didn't put it where I expected it to despite NODE_PATH being set to the same node_modules folder. Prob doing it wrong, just started with node.
I think ejs template engine is not properly installed on your machine. You just install the template engine using npm
npm install ejs --save
then include the following code in app.js
app.set('view engine', 'ejs')
In my case, I just uninstall then install ejs again.
npm uninstall ejs
then
npm install ejs
The error hit me when i was working on goormIDE. This happens basically when node packages arent inside the running file. The place where app.js or home.js is executed.
I my case, I just added ejs manually in package.json:
{
"name": "myApp"
"dependencies": {
"express": "^4.12.2",
"ejs": "^1.0.0"
}
}
And run npm install (may be you need run it with sudo) Please note, that ejs looks views directory by default