Google Clould Functions部署:EROFS:只读文件系统 [英] Google Clould Functions deploy: EROFS: read-only file system

查看:59
本文介绍了Google Clould Functions部署:EROFS:只读文件系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的api部署到Google Cloud Functions,并且得到了这一点:

I'm trying to deploy my api to Google Cloud Functions, and I'm getting this:

EROFS:只读文件系统,mkdir'/user_code/uploads'

EROFS: read-only file system, mkdir '/user_code/uploads'

⚠  functions[post]: Deployment error. Function load error: 
    Code in file index.js can't be loaded. Is there a syntax error in your code? 
    Detailed stack trace: Error: EROFS: read-only file system, mkdir '/user_code/uploads'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:932:18)
    at Function.sync (/user_code/node_modules/multer/node_modules/mkdirp/index.js:71:13)
    at new DiskStorage (/user_code/node_modules/multer/storage/disk.js:21:12)
    at module.exports (/user_code/node_modules/multer/storage/disk.js:65:10)
    at new Multer (/user_code/node_modules/multer/index.js:15:20)
    at multer (/user_code/node_modules/multer/index.js:95:12)
    at Object.<anonymous> (/user_code/api/user.js:105:46)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)

推荐答案

os.tmpdir() (很可能是/tmp ,但您不应该这样假设).如果您有任何尝试在其他任何地方编写的代码(例如,在 api/user.js 中),则会出错.

Everything in the Cloud Functions runtime is read-only except for os.tmpdir() (which is likely going to be /tmp, but you shouldn't assume that). If you have any code (in api/user.js for example) that attempt to write anywhere else, it'll error.

这篇关于Google Clould Functions部署:EROFS:只读文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆