node 使用exceljs读取excel文件出错,提示file node found

node 使用exceljs读取excel文件出错,提示file node found,哪位屌大的帮忙解决一下问题
下面是使用exceljs模块读取文件的代码


var workbook = new Excel.Workbook();
var filePath=path.join(__dirname, "./upload/"+new_excelname);

//console.log(filePath)
workbook.xlsx.readFile(filePath)
    .then(function() {    
        // use workbook
        // Iterate over all sheets
        // Note: workbook.worksheets.forEach will still work but this is better
        workbook.eachSheet(function(worksheet, sheetId) {
          var worksheet = workbook.getWorksheet(0);
          var rowCount=worksheet.rowCount;
          var rowCount=worksheet.columnCount;
          for(let i=0;i<rowCount;i++){
            for( let j='A';j!=columnCount;j++){
              res.send(j+'-'+i)
            }
          }
        });


下面是错误提示

clipboard.png

(node:60240) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: File not found: C:\Users\wenji\Desktop\njdcdss\upload\99800-2018-1-12-工 作簿1.xlsx
(node:60240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
补充:文件确实在该路径下,且文件名无误

阅读 4.5k
1 个回答

如果确定代码没问题,试试用英文做文件名

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题