0

EROFS: read-only file system

Hello,

I need an answer on this magic question:

I use fs.createWriteStream to write a text file and it is work good at first any times. After any times I'm starting to get EROFS: read-only file system.

What can be a reason of it if then it is work good on non-brightsign-devices every time?

6 comments

  • 0
    Avatar
    Bright Scripters

    What path are you writing file to?

  • 0
    Avatar
    Alexander Shipin

    I use the next path "storage/sd/example.txt" and it is work for long time good but at some time is not work and at debug console i see an error "EROFS: read-only file system"

    PS: I checked SD storage value and totally used 125 Mb of 4 Gb

    As example:

    const fs = require("fs")

    ...
    let writeStream = fs.createWriteStream("storage/sd/example.txt");
    writeStream.write(messages.join("\n")); // messages are used as ...messages: string[]
    writeStream.end();
    ...
  • 0
    Avatar
    Bright Scripters

    Try "/storage/sd/..."

    With forward slash at the beginning, so the path is absolute instead of relative.

  • 0
    Avatar
    Alexander Shipin

    I tried the solution as you wrote and an error are continue meet.

    const fs = require("fs");
    const root = "/storage/sd";

    ...
    function write(...messages) {
    let writeStream = fs.createWriteStream(root + "/example.txt");
    writeStream.on("finish", () => console.log("success write"));
    writeStream.on("error", error => throw new Error(error));
    writeStream.write(messsages.join("\n"));
    writeStream.end();
    }
    ...

     

    Is it possible that something are block this?

  • 0
    Avatar
    Bright Scripters

    I don't know if you are supposed to write directly from JS to the SD card.

    In the past I found the JS console very helpful.

    Best would be to consult with the HTML Best Practice page.

    https://brightsign.atlassian.net/wiki/spaces/DOC/pages/370672286/HTML+Best+Practices

     

  • 0
    Avatar
    Alexander Shipin

    In the past I found the console very helpful too and fully consult with HTML Best Practices but not enough for this problem...

    I used createWriteStream/writeFile/writeFileSync and the problem are continue meet..

Please sign in to leave a comment.