Google Cloud Functions 部署:EROFS:只读文件系统 [英] Google Clould Functions deploy: EROFS: read-only file system
本文介绍了Google Cloud 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)
推荐答案
Cloud Functions 运行时中的所有内容都是只读的,除了 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 Cloud Functions 部署:EROFS:只读文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文