问题描述
我一直在Cloud Run实例中成功使用import Router from 'express';
const router = Router();
router.post('/',isAuthorized(),async (req,res) => {
try {
let fruit = new Fruits(req.body);
await fruit.save();
res.json(fruit);
} catch (err) { res.status(503).send(err); }
});
将pyunpack.Archive().extractall(tempdir)
和.tar.gz
文件提取到.zip
中,但是当我尝试使用{ {1}}个文件,我只是得到一个空的临时目录。
奇怪的是,代码在本地运行时有效(在Ubuntu 20.04上)。
我一直想知道它是否与Linux tempfile.TemporaryDirectory
/ .rar
二进制文件的系统安装有关。我只设法使用Docker安装了rar
。尝试安装unrar
或unrar-free
时,尽管添加了Multiverse ppa,我仍然收到“没有安装候选者”错误。
解压缩rar文件时没有错误输出,只是没有任何输出。我还检查了rar文件的完整性。
解决方法
通过添加非免费存储库并安装unrar和unrar-free来解决此问题
RUN apt-get update && \
apt-get install -y software-properties-common && \
apt-get update && \
#apt-get install -y python-software-properties && \
#apt-get update && \
apt-add-repository non-free
RUN apt-get update && \
apt-get install -y \
unrar-free \
unrar