Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error: EROFS: read-only file system, open 'metadata.json'. => I used Firebase Functions. I deployed their json file. I can't able to write that json #920

Unanswered
prshnandaniya asked this question in Q&A
Discussion options

Error: EROFS: read-only file system, open 'metadata.json'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1524:35)
at /workspace/index.js:113:8
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at next (/workspace/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/workspace/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at /workspace/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/workspace/node_modules/express/lib/router/index.js:335:12)
at next (/workspace/node_modules/express/lib/router/index.js:275:10) {

You must be logged in to vote

Replies: 1 comment

Comment options

You're attempting to write to a read-only file system. Firebase Cloud Functions have a read-only file system except for the /tmp directory.

Solution:

Use /tmp: Change the code to write the metadata.json file into the /tmp directory.

const fs = require('fs');
const path = '/tmp/metadata.json';
fs.writeFileSync(path, yourData);

Note that /tmp is temporary storage, so files should be deleted when no longer needed.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /