Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js EJS中的打印错误_Node.js_Ejs - Fatal编程技术网

Node.js EJS中的打印错误

Node.js EJS中的打印错误,node.js,ejs,Node.js,Ejs,我在EJS中有打印错误的问题,因为当我在EJS中使用时,我被引导到错误404 not found。有人能告诉我它是怎么打印出来的吗 req.checkBody('login', 'Login is required').notEmpty(); req.checkBody('password', 'Password is required').notEmpty(); var errors = req.validationErrors(); if (errors) { con

我在EJS中有打印错误的问题,因为当我在EJS中使用时,我被引导到错误404 not found。有人能告诉我它是怎么打印出来的吗

req.checkBody('login', 'Login is required').notEmpty();
  req.checkBody('password', 'Password is required').notEmpty();

  var errors = req.validationErrors();

  if (errors) {
    console.log(errors)
    res.render('index', {
      errors: errors
    });

你需要先初始化错误。例如:res.render'index',{errors:null};在索引页的get方法中