Tag Archives: nodejs、npm、express、gulp

express nodejs Failed to lookup view error in views directory (How to Fix)

The article directories
Article Reference Express configuration interface template Failed to Lookup View “error” in Views Directory solution

This article refer to

    [https://www.cnblogs.com/alian111/p/5766078.html] (Failed to lookup the view “error” in views directory solution)
    Express configuration interface template

    // view engine setup
    app.set('views', path.join(__dirname, 'views'));   //设置模板文件夹的路径
    app.set('view engine', 'html');   //设置视图模板为ejs
    app.engine('html',require('ejs').renderFile);
    

    Failed to Lookup View “error” in Views Directory solution
    When the template is loaded, there must be an error in the views folder. However, we formulated the ejs template in HTML format , so we could not find the error.html and reported an error when the project was loaded. Therefore, a new error.html was created under the Views folder, which successfully solved the problem