Error: Cannot find module 'ejs'

后端 未结 29 2037
南方客
南方客 2020-12-13 05:33

Here is my complete error:

Error: Cannot find module \'ejs\'
    at Function._resolveFilename (module.js:317:11)
    at Function._load (module.js:262:25)
            


        
相关标签:
29条回答
  • 2020-12-13 06:11

    Install it locally rather installing it globally. Then your project may be run on any machine without any error.I think its better.

    npm install express --save
    npm install ejs --save
    
    0 讨论(0)
  • 2020-12-13 06:12

    I have the same issue it resolve after installing the express in my project directory. previously i install it in global scope with -g option with npm install command.

    0 讨论(0)
  • 2020-12-13 06:12

    I face same error for ejs, then i just run node install ejs This will install ejs again.

    and then also run npm install to install node_modules again. That's work for me.

    0 讨论(0)
  • 2020-12-13 06:13

    Reinstalling npm, express and ejs fixed my problem

    This one worked for me,

    1. On your terminal or cmd -> Go to your apps directory,
    2. cd pathtoyourapp/AppName
    3. rerun your 'npm install'
    4. rerun your 'npm install express'
    5. rerun your 'npm install ejs'

    after that, the error was fixed.

    0 讨论(0)
  • 2020-12-13 06:14

    I installed ejs using command npm install ejs in express directory level and this solved my problem.

    i have install express using steps mention in express guide http://expressjs.com/guide.html

    0 讨论(0)
  • 2020-12-13 06:14

    I installed both: express and ejs with the option --save:

    npm install ejs --save npm install express --save

    This way express and ejs are dependecies package.json file.

    0 讨论(0)
提交回复
热议问题