Error: No default engine was specified and no extension was provided

前端 未结 14 2550
别跟我提以往
别跟我提以往 2020-11-29 18:13

I am working through setting up a http server using node.js and engine. However, I keep running into issues that I have little information on how to resolve I would apprecia

相关标签:
14条回答
  • 2020-11-29 18:46

    Error: No default engine was specified and no extension was provided

    I got the same problem(for doing a mean stack project)..the problem is i didn't mentioned the formate to install npm i.e; pug or jade,ejs etc. so to solve this goto npm and enter express --view=pug foldername. This will load necessary pug files(index.pug,layout.pug etc..) in ur given folder .

    0 讨论(0)
  • 2020-11-29 18:48

    If you wish to render a html file, use:

    response.sendfile('index.html');
    

    Then you remove:

    app.set('view engine', 'html');
    

    Put your *.html in the views directory, or serve a public directory as static dir and put the index.html in the public dir.

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