Fixed – node.js – Error: Cannot find module ‘ejs’

When I were working with Nodejs and AngularJS. I got into nodejs. After resolved many problem about nodejs configuration. I got this one “Cannot find module ‘ejs'”. Even though, I have already installed in my app. But it’s still the error message above appear again and again. But Finally, I found the solution. Hope it is useful for you guys.

Solution:

0. Make sure you have express install globally.
1. Remove your ejs on current project.
2. Install again globally:

npm install -g ejs

3. Using npm link to link to ejs at global:

npm link ejs

4. Run again. I’m sure this will work well.

Leave a comment