使用exceljs时报错:no such file or directory
最近使用exceljs生成excel并保存时,总是失败
await workbook.xlsx.writeFile(tep)
.then(function () {
context.result = {
state: true,
url: `算法生成的随机名称.xlsx`
}
//返回xlsx文件的下载位置
return context
}, function (error) {
console.log(error)
});
在打印的error中,总是说no such file or directory,把打印的地址拿出来访问确实访问不了,发现原来是系统环境问题
原来是在linux系统和windows系统中,地址是(linux)斜杠和(win)反斜杠分开的,因此在代码中进行兼容性处理,即用\\来表示\,我的项目环境是Nodejs,验证通过!!
//linux环境
let tep = process.cwd() + `/public/uploads/exp/${match[0] ? match[0].code : ""}_${yyy}.xlsx`; // windows环境
let tep = process.cwd() + '\\src\\public\\uploads\\exp\\' + (match[0] ? match[0].code : '') + "_" + yyy + '.xlsx';
你的问题,也可能是:https://stackoverflow.com/questions/34811222/writefile-no-such-file-or-directory
使用exceljs时报错:no such file or directory的更多相关文章
- Cloud9:解决ThinkPHP在C9上运行时连接数据库时报错"No such file or directory"的问题
昨天尝试在c9上部署了一个ThinkPHP用于开发,但是当试图连接数据库时却出现了这样的问题.经过查找资料发现此问题是由于没有找到mysql.sock这个文件造成的(这个东西估计是mysql的连接线程 ...
- qt+opencv 构建项目时报错——no such file or directory
构建前,记得,一定一定一定要先点击执行qmake:
- CCS5 建立SYS/BIOS工程时报错“cannot find file "./configPkg/linker.cmd" bios”的解决方法
CCS5 建立SYS/BIOS工程时报错“cannot find file "./configPkg/linker.cmd" bios”的解决方法 报错 #10008-D cann ...
- idea中 maven打包时时报错User setting file does not exist C:\Users\lenevo\.m2\setting.xml,
第一种错误 :idea中 maven打包时时报错User setting file does not exist C:\Users\lenevo\.m2\setting.xml, 解决方案如下:将ma ...
- 安装Yellowfin报错——No such file or directory: '/tmp/pip-build-jykvuD/YellowFin/README.md'
https://blog.csdn.net/quqiaoluo5620/article/details/80608474 在Pycharm中安装Yellowfin时一直报错"no such ...
- spring boot打包文件后,报错\No such file or directory
现象: 一段代码: ClassLoader loader = XXXUtil.class.getClassLoader(); String jsFileName = loader.getResourc ...
- mlflow ui 启动报错No such file or directory: 'gunicorn': 'gunicorn'
1.mlflow ui 启动报错,信息如下: [root@localhost mlflow]# mlflow ui /usr/local/python3/lib/python3./importlib/ ...
- php连接mysql报错No such file or directory
php测试文件如下: 1 2 3 4 5 6 7 8 9 10 11 <?php $con = mysql_connect("localhost","root&qu ...
- PHP连接MYSQL 报错"No such file or directory"
首先确定是mysql_connect()和mysql_pconnect()的问题,故障现象就是函数返回空,而mysql_error()返回“No such file or directory”. 写个 ...
随机推荐
- Spring Cloud微服务系统下的数据一致性探讨
我想这个问题需要根据自己的系统具体架构来分别讨论,这边拿一个车联网的系统举例. 拆除GPS这个功能接口需要分几个步骤实现(不涉及数据更新的步骤略去了): ①更改GPS设备状态(设备管理服务) ②更改工 ...
- PHP 的 uniqid 函数产生的 id 真的是唯一的么?
PHP 的 uniqid 函数产生的 id 真的是唯一的么? 最近使用到了 uniqid,就产生了疑问?uniqid 生成的 id 由什么组成?真的是唯一的么?什么情况下会产生冲突? 从文档中看到 u ...
- 解决CentOS 7中php-fpm进程数过多导致服务器内存资源消耗较大的问题
本文由荒原之梦原创,原文链接:http://zhaokaifeng.com/?p=653 什么是php-fpm: php-fpm即FastCGI进程管理器,用于控制php的内存和进程等. 操作环境: ...
- 使用OAuth2的SSO分析
参考:https://github.com/spring-guides/tut-spring-security-and-angular-js/blob/master/oauth2-vanilla/RE ...
- 超实用的JavaScript代码段 Item2 --伸缩菜单栏
伸缩菜单栏 点击标题时判断该标题下的菜单是否显示,如果是显示的则将其隐藏,如果是隐藏的则将其显示出来. <!doctype html> <html lang="en&quo ...
- github代码搜索技巧
github是一个非常丰富的资源,但是面对这丰富的资源很多人不知到怎么使用,更谈不上怎么贡献给他,我们需要使用github就要学习使用他的方法,学会了使用的方法,接受了他的这种观点我们才会慢慢的给他贡 ...
- Ubuntu 16.04下安装64位谷歌Chrome浏览器
1.进入 Ubuntu 16.04 桌面,按下 Ctrl + Alt + t 键盘组合键,启动终端. 也可以按下 Win 键(或叫 Super 键),在 Dash 的搜索框中输入 terminal 或 ...
- 【bzoj 3309 】 DZY Loves Math
Description 对于正整数n,定义f(n)为n所含质因子的最大幂指数.例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0.给定正整数a,b,求 ...
- 种树 BZOJ2151 模拟费用流
分析: 我们如果选择点i,那么我们不能选择i-1和i+1,如果没有这个限制,直接贪心就可行,而加上这个限制,我们考虑同样贪心,每次选择i后,将点i-1,i+1从双向链表中删除,并且将-a[i]+a[i ...
- BZOJ_5249_Luogu_P4364_[2018多省省队联测]_IIIDX_九省联考2018_JLOI2018_线段树
BZOJ_5249_[2018多省省队联测]IIIDX_线段树 Description [题目背景] Osu听过没?那是Konano最喜欢的一款音乐游戏,而他的梦想就是有一天自己也能做个独特酷炫的音乐 ...