首页 > 解决方案 > 错误:提交文档时无法在视图目录中查找视图“索引”

问题描述

我最近将我的站点从 Google Cloud 迁移到 AWS EC2,并且我正在使用 node.js。

该网站是一个工作网站,当我尝试提交文件时,我现在收到以下错误消息。

错误:无法在视图目录中查找视图“索引”“

该提交在本地主机上运行良好(并且在托管在 GCP 上时也是如此)。请你能帮我理解为什么会这样以及如何解决它?这是提交简历的代码

if (req.file){
    console.log("sending CV:"+req.file.path);
  var CVLibrary = {
    url: 'http://www.website.co.uk/cgi-bin/cvsubapi.pl',
    formData:
        {
          title: title,
          firstname: name,
          lastname: lastName,
          email: email,
          county: city,
          town: address2,
          postcode: postCode,
          telephone: phone,
          salary: salary,
          age: Age,
          affiliateID: 20998,
          industry: "Retail",
          affiliatepassword: "coregalm",          
          currentjobtitle: jobCategories ,
          doc: {
            value: fs.createReadStream(req.file.path),
            options: {
              contentType: "application/msword",
              filename: "cv.docx"
            }
          }
        }
  };
  console.log("CV data:" + JSON.stringify(CVLibrary));
  request.post(CVLibrary, function (error, response, body) {
    if (error) {
      console.log("CV Library request sent with error" + error + " body." + body);
      //res.status(400).send(error);
    } else {
      //res.set('Content-Type', 'text/html');
      //res.send(new Buffer(body));
      console.log("request sent correctly CV Library:" + body);
      //res.send(body)
    }
  });

res.render('learnnewskills', {

title: 'Welcome to job site', userInfo: {
  title: title,
  name,
  firstname: name,
  lastname: lastName,
  email: email,
  mobile: phone,
  subAffiliate: listId,
  dob: dob_day + '/' + dob_month + '/' + dob_year,
  optindate: currentTimestamp,
  street1: address1,
  address2,
  towncity: city,
  postcode: postCode,

  tickYes,
  tickYes1,
  ipaddress: ipaddress,
  courseInterestYes:"",
  specificCourseInterest:"",
  costAwareYes:"",
  currentJob,
  list: listId,
  currentTimestamp,
  redcoursetickyes:"",
  penaltyPoints:"",
  DrivingBan:"",
  Redlicence:""
}

});

});

标签: javascriptnode.jsexpressamazon-ec2google-cloud-platform

解决方案


推荐阅读